RefFromBinaryDecode

Trait RefFromBinaryDecode 

Source
pub trait RefFromBinaryDecode {
    type Anchor: Deref<Target = Self>;

    // Required method
    fn ref_decode(
        decoder: &mut DecodedData<'_>,
    ) -> Result<Self::Anchor, DecodeError>;
}
Expand description

Trait for types that can be decoded as references from binary data.

This is the wry-bindgen equivalent of wasm-bindgen’s RefFromWasmAbi. The Anchor type holds the decoded value and keeps the reference valid during callback invocation.

Required Associated Types§

Source

type Anchor: Deref<Target = Self>

The anchor type that keeps the decoded reference valid.

Required Methods§

Source

fn ref_decode( decoder: &mut DecodedData<'_>, ) -> Result<Self::Anchor, DecodeError>

Decode a reference anchor from binary data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> RefFromBinaryDecode for T
where T: JsCast + 'static,