[−][src]Struct wasmprinter::Printer
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.
Implementations
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, usize, &[u8]) -> Result<()> + 'static
)[src]
&mut self,
section: &str,
printer: impl FnMut(&mut Printer, usize, &[u8]) -> Result<()> + 'static
)
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.
The printer function provided takes three arguments:
- A
&mut Printer, or where to print results to - A
usizeoffset which is the start of the offset for the custom section - A byte slice which is the actual contents of the custom section.
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, mut 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
Auto Trait Implementations
impl !RefUnwindSafe for Printer[src]
impl !Send for Printer[src]
impl !Sync for Printer[src]
impl Unpin for Printer[src]
impl !UnwindSafe for Printer[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,