Trait wgpu::web_sys::js_sys::wasm_bindgen::convert::TryFromJsValue
source · pub trait TryFromJsValue: Sized {
type Error;
// Required method
fn try_from_js_value(value: JsValue) -> Result<Self, Self::Error>;
}
Available on
webgl
or webgpu
only.Expand description
TryFromJsValue
is a trait for converting a JavaScript value (JsValue
)
into a Rust type. It is used by the 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
during the conversion process.
Required Associated Types§
Required Methods§
sourcefn try_from_js_value(value: JsValue) -> Result<Self, Self::Error>
fn try_from_js_value(value: JsValue) -> Result<Self, Self::Error>
Performs the conversion.
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl TryFromJsValue for String
Available on crate feature std
only.
impl TryFromJsValue for String
Available on crate feature
std
only.