Skip to main content

TryCastJsInto

Trait TryCastJsInto 

Source
pub trait TryCastJsInto<T>
where T: TryCastFromJs,
{ type Error: From<Error>; // Required methods fn try_into_cast(&self) -> Result<Cast<'_, T>, Self::Error>; fn try_into_owned(&self) -> Result<T, Self::Error>; }
Expand description

Inverse of TryCastFromJs, allowing a source value (such as a JsValue) to be cast into a target Rust type T that implements TryCastFromJs.

Required Associated Types§

Source

type Error: From<Error>

Error type returned by the conversion, convertible from Error.

Required Methods§

Source

fn try_into_cast(&self) -> Result<Cast<'_, T>, Self::Error>

Attempt to cast self into a Cast wrapping the target type T.

Source

fn try_into_owned(&self) -> Result<T, Self::Error>

Attempt to cast self into an owned value of the target type T.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§