Struct wasmbin::builtins::Blob

source ·
pub struct Blob<T: Decode> {
    pub contents: Lazy<T>,
}
Expand description

A length-prefixed blob that can be skipped over during decoding.

Fields§

§contents: Lazy<T>

Lazily-decoded contents of the blob.

Methods from Deref<Target = Lazy<T>>§

source

pub fn try_as_raw(&self) -> Result<&UnparsedBytes, &T>

Retrieve the raw bytes if the value has not been modified yet.

source

pub fn try_contents(&self) -> Result<&T, DecodeError>

Retrieve a reference to the inner value, decoding it if it wasn’t already.

source

pub fn try_contents_mut(&mut self) -> Result<&mut T, DecodeError>

Retrieve a mutable reference to the inner value, decoding it if it wasn’t already.

This will invalidate the original raw bytes.

Trait Implementations§

source§

impl<T: Clone + Decode> Clone for Blob<T>

source§

fn clone(&self) -> Blob<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Decode + Debug> Debug for Blob<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Decode> Decode for Blob<T>

source§

fn decode(r: &mut impl Read) -> Result<Self, DecodeError>

Decodes the value from the given reader.
source§

impl<T: Default + Decode> Default for Blob<T>

source§

fn default() -> Blob<T>

Returns the “default value” for a type. Read more
source§

impl<T: Decode> Deref for Blob<T>

§

type Target = Lazy<T>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: Decode> DerefMut for Blob<T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<T: Decode + Encode> Encode for Blob<T>

source§

fn encode(&self, w: &mut impl Write) -> Result<()>

Encodes the value into the given writer.
source§

impl From<Blob<CustomSection>> for Section

source§

fn from(value: Blob<Custom>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<FuncId>> for Section

source§

fn from(value: Blob<Start>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<Vec<Blob<FuncBody>>>> for Section

source§

fn from(value: Blob<Code>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<Vec<Data>>> for Section

source§

fn from(value: Blob<Data>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<Vec<Element>>> for Section

source§

fn from(value: Blob<Element>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<Vec<Exception>>> for Section

Available on crate feature exception-handling only.
source§

fn from(value: Blob<Exception>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<Vec<Export>>> for Section

source§

fn from(value: Blob<Export>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<Vec<FuncType>>> for Section

source§

fn from(value: Blob<Type>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<Vec<Global>>> for Section

source§

fn from(value: Blob<Global>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<Vec<Import>>> for Section

source§

fn from(value: Blob<Import>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<Vec<MemType>>> for Section

source§

fn from(value: Blob<Memory>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<Vec<TableType>>> for Section

source§

fn from(value: Blob<Table>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<Vec<TypeId>>> for Section

source§

fn from(value: Blob<Function>) -> Self

Converts to this type from the input type.
source§

impl From<Blob<u32>> for Section

source§

fn from(value: Blob<DataCount>) -> Self

Converts to this type from the input type.
source§

impl<T: Decode> From<T> for Blob<T>

source§

fn from(value: T) -> Self

Converts to this type from the input type.
source§

impl<T: Hash + Decode> Hash for Blob<T>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T: PartialEq + Decode> PartialEq for Blob<T>

source§

fn eq(&self, other: &Blob<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Visit for Blob<T>
where Self: 'static, Lazy<T>: Visit, T: Visit + Decode,

source§

fn visit_children<'a, VisitT: 'static, VisitE, VisitF: FnMut(&'a VisitT) -> Result<(), VisitE>>( &'a self, f: &mut VisitF ) -> Result<(), VisitError<VisitE>>

Traverse the children of this value with the provided callback.
source§

fn visit_children_mut<VisitT: 'static, VisitE, VisitF: FnMut(&mut VisitT) -> Result<(), VisitE>>( &mut self, f: &mut VisitF ) -> Result<(), VisitError<VisitE>>

Traverse the children of this value mutably with the provided callback.
source§

fn visit<'a, T: 'static, R: VisitResult, F: FnMut(&'a T) -> R>( &'a self, f: F ) -> Result<(), VisitError<R::Error>>

Traverse this value with the provided callback.
source§

fn visit_mut<T: 'static, R: VisitResult, F: FnMut(&mut T) -> R>( &mut self, f: F ) -> Result<(), VisitError<R::Error>>

Traverse this value mutably with the provided callback.
source§

impl<T: Eq + Decode> Eq for Blob<T>

source§

impl<T: Decode> StructuralEq for Blob<T>

source§

impl<T: Decode> StructuralPartialEq for Blob<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Blob<T>

§

impl<T> Send for Blob<T>
where T: Send,

§

impl<T> Sync for Blob<T>
where T: Sync + Send,

§

impl<T> Unpin for Blob<T>
where T: Unpin,

§

impl<T> UnwindSafe for Blob<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.