Enum workflow_wasm::convert::Cast
source · pub enum Cast<T>{
Ref(<T as RefFromWasmAbi>::Anchor),
LongRef(<T as LongRefFromWasmAbi>::Anchor),
Value(T),
}
Expand description
A wrapper for a Rust object that can be either a reference or a value.
This wrapper is used to carry a Rust (WASM ABI) reference provided by
wasm_bindgen
, but at the same time allows creation of a temporary
object that can be created by interpreting the source user-supplied data.
Cast
then provides Cast::as_ref()
to obtain the internally held
reference and Cast::into_owned()
where the latter will consume the
value or clone the reference.
Variants§
Implementations§
source§impl<T> Cast<T>
impl<T> Cast<T>
sourcepub fn into_owned(self) -> T
pub fn into_owned(self) -> T
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Cast<T>
impl<T> RefUnwindSafe for Cast<T>where
<T as RefFromWasmAbi>::Anchor: RefUnwindSafe,
<T as LongRefFromWasmAbi>::Anchor: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Cast<T>
impl<T> Sync for Cast<T>
impl<T> Unpin for Cast<T>
impl<T> UnwindSafe for Cast<T>where
<T as RefFromWasmAbi>::Anchor: UnwindSafe,
<T as LongRefFromWasmAbi>::Anchor: UnwindSafe,
T: UnwindSafe,
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