#[repr(u8)]
pub enum Section {
Show 14 variants Custom(Blob<Custom>), Type(Blob<Type>), Import(Blob<Import>), Function(Blob<Function>), Table(Blob<Table>), Memory(Blob<Memory>), Exception(Blob<Exception>), Global(Blob<Global>), Export(Blob<Export>), Start(Blob<Start>), Element(Blob<Element>), DataCount(Blob<DataCount>), Code(Blob<Code>), Data(Blob<Data>),
}
Expand description

Variants§

§

Custom(Blob<Custom>)

§

Type(Blob<Type>)

§

Import(Blob<Import>)

§

Function(Blob<Function>)

§

Table(Blob<Table>)

§

Memory(Blob<Memory>)

§

Exception(Blob<Exception>)

Available on crate feature exception-handling only.
§

Global(Blob<Global>)

§

Export(Blob<Export>)

§

Start(Blob<Start>)

Tuple Fields

§

Element(Blob<Element>)

§

DataCount(Blob<DataCount>)

Tuple Fields

§0: Blob<DataCount>

Number of data segments in the Data section.

§

Code(Blob<Code>)

§

Data(Blob<Data>)

Implementations§

source§

impl Section

source

pub fn kind(&self) -> Kind

Get the kind of the section without its payload.

source

pub fn try_as<T: Payload>(&self) -> Option<&Blob<T>>

Try to interpret the section as a specific payload.

source

pub fn try_as_mut<T: Payload>(&mut self) -> Option<&mut Blob<T>>

Try to interpret the section as a specific payload mutably.

Trait Implementations§

source§

impl Clone for Section

source§

fn clone(&self) -> Section

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 Debug for Section

source§

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

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

impl Decode for Section

source§

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

Decodes the value from the given reader.
source§

impl DecodeWithDiscriminant for Section

§

type Discriminant = u8

The discriminant representation.
source§

fn maybe_decode_with_discriminant( discriminant: u8, r: &mut impl Read ) -> Result<Option<Self>, DecodeError>

Decodes the value from the given reader, if the discriminant matches. Read more
source§

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

Decodes the value from the given reader, if the discriminant matches. Read more
source§

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

Decodes this value fully, including the discriminant. Read more
source§

impl Encode for Section

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 From<CustomSection> for Section

source§

fn from(value: Custom) -> Self

Converts to this type from the input type.
source§

impl From<FuncId> for Section

source§

fn from(value: Start) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(value: Code) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Data>> for Section

source§

fn from(value: Data) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Element>> for Section

source§

fn from(value: Element) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Exception>> for Section

Available on crate feature exception-handling only.
source§

fn from(value: Exception) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Export>> for Section

source§

fn from(value: Export) -> Self

Converts to this type from the input type.
source§

impl From<Vec<FuncType>> for Section

source§

fn from(value: Type) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Global>> for Section

source§

fn from(value: Global) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Import>> for Section

source§

fn from(value: Import) -> Self

Converts to this type from the input type.
source§

impl From<Vec<MemType>> for Section

source§

fn from(value: Memory) -> Self

Converts to this type from the input type.
source§

impl From<Vec<TableType>> for Section

source§

fn from(value: Table) -> Self

Converts to this type from the input type.
source§

impl From<Vec<TypeId>> for Section

source§

fn from(value: Function) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Section

source§

fn from(value: DataCount) -> Self

Converts to this type from the input type.
source§

impl Hash for Section

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 PartialEq for Section

source§

fn eq(&self, other: &Section) -> 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 Visit for Section
where Self: 'static,

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 Eq for Section

source§

impl StructuralEq for Section

source§

impl StructuralPartialEq for Section

Auto Trait Implementations§

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.