@@ -74,7 +74,10 @@ pub fn wrapper(attributes: TokenStream, item: TokenStream) -> TokenStream {
7474
7575 // prevent warnings when the body is a `compile_error!` or if the command has no arguments
7676 #[ allow( unused_variables) ]
77- let :: tauri:: Invoke { message, resolver } = $invoke;
77+ let :: tauri:: Invoke {
78+ message: __tauri_message__,
79+ resolver: __tauri_resolver__
80+ } = $invoke;
7881
7982 #body
8083 } } ;
@@ -91,14 +94,14 @@ pub fn wrapper(attributes: TokenStream, item: TokenStream) -> TokenStream {
9194///
9295/// See the [`tauri::command`] module for all the items and traits that make this possible.
9396///
94- /// * Requires binding `message ` and `resolver `.
97+ /// * Requires binding `__tauri_message__ ` and `__tauri_resolver__ `.
9598/// * Requires all the traits from `tauri::command::private` to be in scope.
9699///
97100/// [`tauri::command`]: https://docs.rs/tauri/*/tauri/runtime/index.html
98101fn body_async ( function : & ItemFn ) -> syn:: Result < TokenStream2 > {
99102 parse_args ( function) . map ( |args| {
100103 quote ! {
101- resolver . respond_async_serialized( async move {
104+ __tauri_resolver__ . respond_async_serialized( async move {
102105 let result = $path( #( #args?) , * ) ;
103106 let kind = ( & result) . async_kind( ) ;
104107 kind. future( result) . await
@@ -111,7 +114,7 @@ fn body_async(function: &ItemFn) -> syn::Result<TokenStream2> {
111114///
112115/// See the [`tauri::command`] module for all the items and traits that make this possible.
113116///
114- /// * Requires binding `message ` and `resolver `.
117+ /// * Requires binding `__tauri_message__ ` and `__tauri_resolver__ `.
115118/// * Requires all the traits from `tauri::command::private` to be in scope.
116119///
117120/// [`tauri::command`]: https://docs.rs/tauri/*/tauri/runtime/index.html
@@ -121,13 +124,13 @@ fn body_blocking(function: &ItemFn) -> syn::Result<TokenStream2> {
121124 // the body of a `match` to early return any argument that wasn't successful in parsing.
122125 let match_body = quote ! ( {
123126 Ok ( arg) => arg,
124- Err ( err) => return resolver . invoke_error( err) ,
127+ Err ( err) => return __tauri_resolver__ . invoke_error( err) ,
125128 } ) ;
126129
127130 Ok ( quote ! {
128131 let result = $path( #( match #args #match_body) , * ) ;
129132 let kind = ( & result) . blocking_kind( ) ;
130- kind. block( result, resolver ) ;
133+ kind. block( result, __tauri_resolver__ ) ;
131134 } )
132135}
133136
@@ -143,7 +146,7 @@ fn parse_args(function: &ItemFn) -> syn::Result<Vec<TokenStream2>> {
143146
144147/// Transform a [`FnArg`] into a command argument.
145148///
146- /// * Requires binding `message `.
149+ /// * Requires binding `__tauri_message__ `.
147150fn parse_arg ( command : & Ident , arg : & FnArg ) -> syn:: Result < TokenStream2 > {
148151 // we have no use for self arguments
149152 let mut arg = match arg {
@@ -187,7 +190,7 @@ fn parse_arg(command: &Ident, arg: &FnArg) -> syn::Result<TokenStream2> {
187190 :: tauri:: command:: CommandItem {
188191 name: stringify!( #command) ,
189192 key: #key,
190- message: & message ,
193+ message: & __tauri_message__ ,
191194 }
192195 ) ) )
193196}
0 commit comments