Skip to content

Commit

Permalink
Update TryFromJsValue documented comment
Browse files Browse the repository at this point in the history
Co-authored-by: daxpedda <[email protected]>
  • Loading branch information
biryukovmaxim and daxpedda authored Nov 16, 2023
1 parent 2d37f18 commit 306d293
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/convert/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,12 @@ impl<T: WasmAbi> WasmRet<T> {
}
}

/// `TryFromJsValue` is a trait for converting a JavaScript value (`JsValue`)
/// into a Rust type. It is particularly useful when dealing with JavaScript
/// objects in WebAssembly, allowing for custom conversion logic that might
/// be needed when interacting with JavaScript APIs or passing data between
/// Rust and JavaScript.
///
/// This trait is intended as a solution to the limitations imposed by the
/// automatic derivation of `TryFrom<JsValue>` in `wasm-bindgen`, which
/// restricts the ability to implement custom conversions for ABI-bound structs.
/// [`TryFromJsValue`] is a trait for converting a JavaScript value ([`JsValue`])
/// into a Rust type. It is used by the [`wasm_bindgen`](wasm_bindgen_macro::wasm_bindgen)
/// proc-macro to allow conversion to user types.
///
/// Types implementing this trait must specify their conversion logic from
/// `JsValue` to the Rust type, handling any potential errors that may occur
/// [`JsValue`] to the Rust type, handling any potential errors that may occur
/// during the conversion process.
pub trait TryFromJsValue: Sized {
/// The type returned in the event of a conversion error.
Expand Down

0 comments on commit 306d293

Please sign in to comment.