File tree Expand file tree Collapse file tree 4 files changed +14
-9
lines changed
tauri-interop-macro/src/command Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -253,9 +253,6 @@ fn main() {
253
253
```
254
254
255
255
## Known Issues:
256
- - arguments used in ` tauri::command ` beginning with ` _ ` aren't supported yet
257
- - due to [ tauri internally converting the argument name] ( https://tauri.app/v1/guides/features/command#passing-arguments ) ,
258
- which results in losing the _ at the beginning
259
256
- feature: leptos
260
257
- sometimes a closure is accessed after being dropped
261
258
- that is probably a race condition where the unlisten function doesn't detach the callback fast enough
Original file line number Diff line number Diff line change @@ -127,12 +127,16 @@ pub fn prepare(function: ItemFn) -> InvokeCommand {
127
127
false
128
128
} ;
129
129
130
- match typed. pat . as_ref ( ) {
131
- Pat :: Ident ( ident) => Some ( FieldArg {
132
- ident : ident. ident . clone ( ) ,
133
- argument : fn_arg,
134
- requires_lifetime : req_lf,
135
- } ) ,
130
+ match typed. pat . as_mut ( ) {
131
+ Pat :: Ident ( ident) => {
132
+ // converting the ident to snake case, so it matches the expected snake case
133
+ ident. ident = format_ident ! ( "{}" , ident. ident. to_string( ) . to_case( Case :: Snake ) ) ;
134
+ Some ( FieldArg {
135
+ ident : ident. ident . clone ( ) ,
136
+ argument : fn_arg,
137
+ requires_lifetime : req_lf,
138
+ } )
139
+ } ,
136
140
_ => None ,
137
141
}
138
142
} )
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ tauri_interop::host_usage! {
10
10
#[ tauri_interop:: command]
11
11
pub fn empty_invoke ( ) { }
12
12
13
+ #[ tauri_interop:: command]
14
+ pub fn underscore_invoke ( _invoke : u8 ) { }
15
+
13
16
#[ tauri_interop:: command]
14
17
pub async fn await_heavy_computing ( ) {
15
18
std:: thread:: sleep ( std:: time:: Duration :: from_millis ( 5000 ) )
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ fn main() {
11
11
console_error_panic_hook:: set_once ( ) ;
12
12
13
13
api:: cmd:: empty_invoke ( ) ;
14
+ api:: cmd:: underscore_invoke ( 69 ) ;
14
15
15
16
wasm_bindgen_futures:: spawn_local ( async {
16
17
log:: info!( "{}" , api:: cmd:: greet( "frontend" ) . await ) ;
You can’t perform that action at this time.
0 commit comments