Struct tauri::InvokeResolver
source · pub struct InvokeResolver<R: Runtime = Wry> { /* private fields */ }
Expand description
Resolver of a invoke message.
Implementations§
source§impl<R: Runtime> InvokeResolver<R>
impl<R: Runtime> InvokeResolver<R>
sourcepub fn respond_async<T, F>(self, task: F)where
T: Serialize,
F: Future<Output = Result<T, InvokeError>> + Send + 'static,
pub fn respond_async<T, F>(self, task: F)where T: Serialize, F: Future<Output = Result<T, InvokeError>> + Send + 'static,
Reply to the invoke promise with an async task.
sourcepub fn respond_async_serialized<F>(self, task: F)where
F: Future<Output = Result<JsonValue, InvokeError>> + Send + 'static,
pub fn respond_async_serialized<F>(self, task: F)where F: Future<Output = Result<JsonValue, InvokeError>> + Send + 'static,
Reply to the invoke promise with an async task which is already serialized.
sourcepub fn respond<T: Serialize>(self, value: Result<T, InvokeError>)
pub fn respond<T: Serialize>(self, value: Result<T, InvokeError>)
Reply to the invoke promise with a serializable value.
sourcepub fn invoke_error(self, error: InvokeError)
pub fn invoke_error(self, error: InvokeError)
Reject the invoke promise with an InvokeError
.
sourcepub async fn return_task<T, F>(
window: Window<R>,
task: F,
success_callback: CallbackFn,
error_callback: CallbackFn
)where
T: Serialize,
F: Future<Output = Result<T, InvokeError>> + Send + 'static,
pub async fn return_task<T, F>( window: Window<R>, task: F, success_callback: CallbackFn, error_callback: CallbackFn )where T: Serialize, F: Future<Output = Result<T, InvokeError>> + Send + 'static,
Asynchronously executes the given task
and evaluates its Result to the JS promise described by the success_callback
and error_callback
function names.
If the Result is_ok()
, the callback will be the success_callback
function name and the argument will be the Ok value.
If the Result is_err()
, the callback will be the error_callback
function name and the argument will be the Err value.
Trait Implementations§
Auto Trait Implementations§
impl<R = Wry<EventLoopMessage>> !RefUnwindSafe for InvokeResolver<R>
impl<R> Send for InvokeResolver<R>
impl<R> Sync for InvokeResolver<R>
impl<R> Unpin for InvokeResolver<R>where <R as Runtime<EventLoopMessage>>::ClipboardManager: Unpin, <R as Runtime<EventLoopMessage>>::Dispatcher: Unpin, <R as Runtime<EventLoopMessage>>::GlobalShortcutManager: Unpin, <R as Runtime<EventLoopMessage>>::Handle: Unpin, <R as Runtime<EventLoopMessage>>::TrayHandler: Unpin,
impl<R = Wry<EventLoopMessage>> !UnwindSafe for InvokeResolver<R>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more