Struct wasmer::FrameInfo

pub struct FrameInfo {
    module_name: String,
    func_index: u32,
    function_name: Option<String>,
    func_start: SourceLoc,
    instr: SourceLoc,
}
Expand description

Description of a frame in a backtrace.

Each runtime error includes a backtrace of the WebAssembly frames that led to the trap, and each frame is described by this structure.

Fields§

§module_name: String§func_index: u32§function_name: Option<String>§func_start: SourceLoc§instr: SourceLoc

Implementations§

§

impl FrameInfo

pub fn new( module_name: String, func_index: u32, function_name: Option<String>, func_start: SourceLoc, instr: SourceLoc ) -> FrameInfo

Creates a new FrameInfo, useful for testing.

pub fn func_index(&self) -> u32

Returns the WebAssembly function index for this frame.

This function index is the index in the function index space of the WebAssembly module that this frame comes from.

pub fn module_name(&self) -> &str

Returns the identifer of the module that this frame is for.

ModuleInfo identifiers are present in the name section of a WebAssembly binary, but this may not return the exact item in the name section. ModuleInfo names can be overwritten at construction time or perhaps inferred from file names. The primary purpose of this function is to assist in debugging and therefore may be tweaked over time.

This function returns None when no name can be found or inferred.

pub fn function_name(&self) -> Option<&str>

Returns a descriptive name of the function for this frame, if one is available.

The name of this function may come from the name section of the WebAssembly binary, or wasmer may try to infer a better name for it if not available, for example the name of the export if it’s exported.

This return value is primarily used for debugging and human-readable purposes for things like traps. Note that the exact return value may be tweaked over time here and isn’t guaranteed to be something in particular about a wasm module due to its primary purpose of assisting in debugging.

This function returns None when no name could be inferred.

pub fn module_offset(&self) -> usize

Returns the offset within the original wasm module this frame’s program counter was at.

The offset here is the offset from the beginning of the original wasm module to the instruction that this frame points to.

pub fn func_offset(&self) -> usize

Returns the offset from the original wasm module’s function to this frame’s program counter.

The offset here is the offset from the beginning of the defining function of this frame (within the wasm module) to the instruction this frame points to.

Trait Implementations§

§

impl Clone for FrameInfo

§

fn clone(&self) -> FrameInfo

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
§

impl Debug for FrameInfo

§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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.
§

impl<T> Upcastable for Twhere T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T, Global>) -> Box<dyn Any, Global>

upcast boxed dyn
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more