Struct tauri::InvokeResolver
source · 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.