[][src]Struct wasmprinter::Printer

pub struct Printer { /* fields omitted */ }

Context used for printing a WebAssembly binary.

This is largely only required if you'd like to register custom printers for custom sections in a wasm binary.

Methods

impl Printer[src]

pub fn new() -> Printer[src]

Creates a new Printer object that's ready to start printing wasm binaries to strings.

pub fn add_custom_section_printer(
    &mut self,
    section: &str,
    printer: impl FnMut(&mut Printer, &[u8]) -> Result<()> + 'static
)
[src]

Registers a custom printer function to get invoked whenever a custom section of name section is seen.

This can be used to register printers into a textual format for custom sections, such as by emitting annotations and/or other textual references (maybe coments!)

By default all custom sections are ignored for the text format.

pub fn result_mut(&mut self) -> &mut String[src]

Gets the output result of this Printer, or where all output is going.

pub fn print(&mut self, wasm: &[u8]) -> Result<String>[src]

Prints a WebAssembly binary into a String

This function takes an entire wasm binary blob and will print it to the WebAssembly Text Format and return the result as a String.

pub fn print_func_idx(&mut self, idx: u32) -> Result<()>[src]

Prints a function index specified, using the identifier for the function from the name section if it was present.

This will either print $foo or idx as a raw integer.

Trait Implementations

impl Default for Printer[src]

Auto Trait Implementations

impl !Send for Printer

impl !Sync for Printer

impl Unpin for Printer

impl !UnwindSafe for Printer

impl !RefUnwindSafe for Printer

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]