pub struct FrameInfo { /* private fields */ }
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.
Implementations§
Source§impl FrameInfo
impl FrameInfo
Sourcepub fn new(
module_name: String,
func_index: u32,
function_name: Option<String>,
func_start: SourceLoc,
instr: SourceLoc,
) -> Self
pub fn new( module_name: String, func_index: u32, function_name: Option<String>, func_start: SourceLoc, instr: SourceLoc, ) -> Self
Creates a new FrameInfo, useful for testing.
Sourcepub fn func_index(&self) -> u32
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.
Sourcepub fn module_name(&self) -> &str
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.
Sourcepub fn function_name(&self) -> Option<&str>
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.
Sourcepub fn module_offset(&self) -> usize
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.
Sourcepub fn func_offset(&self) -> usize
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§
Auto Trait Implementations§
impl Freeze for FrameInfo
impl RefUnwindSafe for FrameInfo
impl Send for FrameInfo
impl Sync for FrameInfo
impl Unpin for FrameInfo
impl UnwindSafe for FrameInfo
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.