pub struct JsExportSpec {
pub name: &'static str,
pub handler: fn(&mut DecodedData<'_>) -> Result<EncodedData, String>,
}Expand description
Specification for an exported Rust function/method callable from JavaScript.
This is used by the #[wasm_bindgen] macro when exporting structs and impl blocks.
Each export is registered via inventory and collected at runtime.
Fields§
§name: &'static strThe export name (e.g., “MyStruct::new”, “MyStruct::method”)
handler: fn(&mut DecodedData<'_>) -> Result<EncodedData, String>Handler function that decodes arguments, calls the Rust function, and encodes the result
Implementations§
Source§impl JsExportSpec
impl JsExportSpec
pub const fn new( name: &'static str, handler: fn(&mut DecodedData<'_>) -> Result<EncodedData, String>, ) -> JsExportSpec
Trait Implementations§
Source§impl Clone for JsExportSpec
impl Clone for JsExportSpec
Source§fn clone(&self) -> JsExportSpec
fn clone(&self) -> JsExportSpec
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Collect for JsExportSpec
impl Copy for JsExportSpec
Auto Trait Implementations§
impl Freeze for JsExportSpec
impl RefUnwindSafe for JsExportSpec
impl Send for JsExportSpec
impl Sync for JsExportSpec
impl Unpin for JsExportSpec
impl UnwindSafe for JsExportSpec
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