Struct workflow_wasm::callback::Callback  
source · pub struct Callback<T: ?Sized> { /* private fields */ }Expand description
Callback is a struct that owns a given Rust closure
meant to be bound to JavaScript as a callback.
Implementations§
source§impl<T> Callback<T>
 
impl<T> Callback<T>
pub fn new_with_args_0<R>(callback: T) -> Callback<dyn FnMut() -> R>where T: 'static + FnMut() -> R, R: ReturnWasmAbi + 'static,
pub fn new_with_args_1<A, R>(callback: T) -> Callback<dyn FnMut(A) -> R>where T: 'static + FnMut(A) -> R, A: FromWasmAbi + 'static, R: ReturnWasmAbi + 'static,
pub fn new_with_args_2<A, B, R>(callback: T) -> Callback<dyn FnMut(A, B) -> R>where T: 'static + FnMut(A, B) -> R, A: FromWasmAbi + 'static, B: FromWasmAbi + 'static, R: ReturnWasmAbi + 'static,
pub fn new_with_args_3<A, B, C, R>( callback: T ) -> Callback<dyn FnMut(A, B, C) -> R>where T: 'static + FnMut(A, B, C) -> R, A: FromWasmAbi + 'static, B: FromWasmAbi + 'static, C: FromWasmAbi + 'static, R: ReturnWasmAbi + 'static,
pub fn new_with_args_4<A, B, C, D, R>( callback: T ) -> Callback<dyn FnMut(A, B, C, D) -> R>where T: 'static + FnMut(A, B, C, D) -> R, A: FromWasmAbi + 'static, B: FromWasmAbi + 'static, C: FromWasmAbi + 'static, D: FromWasmAbi + 'static, R: ReturnWasmAbi + 'static,
pub fn new_with_args_5<A, B, C, D, E, R>( callback: T ) -> Callback<dyn FnMut(A, B, C, D, E) -> R>where T: 'static + FnMut(A, B, C, D, E) -> R, A: FromWasmAbi + 'static, B: FromWasmAbi + 'static, C: FromWasmAbi + 'static, D: FromWasmAbi + 'static, E: FromWasmAbi + 'static, R: ReturnWasmAbi + 'static,
pub fn new_with_args_6<A, B, C, D, E, F, R>( callback: T ) -> Callback<dyn FnMut(A, B, C, D, E, F) -> R>where T: 'static + FnMut(A, B, C, D, E, F) -> R, A: FromWasmAbi + 'static, B: FromWasmAbi + 'static, C: FromWasmAbi + 'static, D: FromWasmAbi + 'static, E: FromWasmAbi + 'static, F: FromWasmAbi + 'static, R: ReturnWasmAbi + 'static,
pub fn new_with_args_7<A, B, C, D, E, F, G, R>( callback: T ) -> Callback<dyn FnMut(A, B, C, D, E, F, G) -> R>where T: 'static + FnMut(A, B, C, D, E, F, G) -> R, A: FromWasmAbi + 'static, B: FromWasmAbi + 'static, C: FromWasmAbi + 'static, D: FromWasmAbi + 'static, E: FromWasmAbi + 'static, F: FromWasmAbi + 'static, G: FromWasmAbi + 'static, R: ReturnWasmAbi + 'static,
pub fn new_with_args_8<A, B, C, D, E, F, G, H, R>( callback: T ) -> Callback<dyn FnMut(A, B, C, D, E, F, G, H) -> R>where T: 'static + FnMut(A, B, C, D, E, F, G, H) -> R, A: FromWasmAbi + 'static, B: FromWasmAbi + 'static, C: FromWasmAbi + 'static, D: FromWasmAbi + 'static, E: FromWasmAbi + 'static, F: FromWasmAbi + 'static, G: FromWasmAbi + 'static, H: FromWasmAbi + 'static, R: ReturnWasmAbi + 'static,
sourcepub fn new<A, R>(callback: T) -> Callback<dyn FnMut(A) -> R>where
    T: 'static + FnMut(A) -> R,
    A: FromWasmAbi + 'static,
    R: ReturnWasmAbi + 'static,
 
pub fn new<A, R>(callback: T) -> Callback<dyn FnMut(A) -> R>where T: 'static + FnMut(A) -> R, A: FromWasmAbi + 'static, R: ReturnWasmAbi + 'static,
Create a new Callback instance with the given closure.
source§impl<T> Callback<T>where
    T: ?Sized + WasmClosure + 'static,
 
impl<T> Callback<T>where T: ?Sized + WasmClosure + 'static,
sourcepub fn create<F>(t: F) -> Selfwhere
    F: IntoWasmClosure<T> + 'static,
 
pub fn create<F>(t: F) -> Selfwhere F: IntoWasmClosure<T> + 'static,
Create a new Callback instance with the given closure.
sourcepub fn set_closure<F>(&mut self, t: F)where
    F: IntoWasmClosure<T> + 'static,
 
pub fn set_closure<F>(&mut self, t: F)where F: IntoWasmClosure<T> + 'static,
Set closure in the given Callback instance.
sourcepub fn into_js<J>(&self) -> &Jwhere
    J: JsCast,
 
pub fn into_js<J>(&self) -> &Jwhere J: JsCast,
Obtain a wasm_bindgen::JsCast value for this callback.
sourcepub fn closure(&self) -> CallbackResult<Arc<Closure<T>>>
 
pub fn closure(&self) -> CallbackResult<Arc<Closure<T>>>
Obtain an std::sync::Arc of the given closure.
Returns CallbackError::ClosureNotInitialized if the closure is None.