Struct EncodeOptions

Source
pub struct EncodeOptions<'a> { /* private fields */ }
Expand description

Options that can be specified when encoding a component or a module to customize what the final binary looks like.

Methods such as Module::encode, Wat::encode, and Component::encode will use the default options.

Implementations§

Source§

impl<'a> EncodeOptions<'a>

Source

pub fn new() -> EncodeOptions<'a>

Creates a new set of default encoding options.

Source

pub fn dwarf( &mut self, file: &'a Path, contents: &'a str, style: GenerateDwarf, ) -> &mut Self

Available on crate feature dwarf only.

Enables emission of DWARF debugging information in the final binary.

This method will use the file specified as the source file for the *.wat file whose contents must also be supplied here. These are used to calculate filenames/line numbers and are referenced from the generated DWARF.

Source

pub fn encode_module(&self, module: &mut Module<'_>) -> Result<Vec<u8>, Error>

Encodes the given Module with these options.

For more information see Module::encode.

Source

pub fn encode_component( &self, component: &mut Component<'_>, ) -> Result<Vec<u8>, Error>

Available on crate feature component-model only.

Encodes the given Component with these options.

For more information see Component::encode.

Source

pub fn encode_wat(&self, wat: &mut Wat<'_>) -> Result<Vec<u8>, Error>

Encodes the given Wat with these options.

For more information see Wat::encode.

Trait Implementations§

Source§

impl<'a> Default for EncodeOptions<'a>

Source§

fn default() -> EncodeOptions<'a>

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

Auto Trait Implementations§

§

impl<'a> Freeze for EncodeOptions<'a>

§

impl<'a> RefUnwindSafe for EncodeOptions<'a>

§

impl<'a> Send for EncodeOptions<'a>

§

impl<'a> Sync for EncodeOptions<'a>

§

impl<'a> Unpin for EncodeOptions<'a>

§

impl<'a> UnwindSafe for EncodeOptions<'a>

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.