Struct Symbol

pub struct Symbol { pub(in ::backtrace_rs::symbolize) inner: Symbol<'static> }

A trait representing the resolution of a symbol in a file.

This trait is yielded as a trait object to the closure given to the backtrace::resolve function, and it is virtually dispatched as it's unknown which implementation is behind it.

A symbol can give contextual information about a function, for example the name, filename, line number, precise address, etc. Not all information is always available in a symbol, however, so all methods return an Option.

Fields

inner: Symbol<'static>

Implementations

impl Symbol

fn name(&self) -> Option<SymbolName<'_>>

Returns the name of this function.

The returned structure can be used to query various properties about the symbol name:

  • The Display implementation will print out the demangled symbol.
  • The raw str value of the symbol can be accessed (if it's valid utf-8).
  • The raw bytes for the symbol name can be accessed.
fn addr(&self) -> Option<*mut c_void>

Returns the starting address of this function.

fn filename_raw(&self) -> Option<BytesOrWideString<'_>>

Returns the raw filename as a slice. This is mainly useful for no_std environments.

fn colno(&self) -> Option<u32>

Returns the column number for where this symbol is currently executing.

Only gimli currently provides a value here and even then only if filename returns Some, and so it is then consequently subject to similar caveats.

fn lineno(&self) -> Option<u32>

Returns the line number for where this symbol is currently executing.

This return value is typically Some if filename returns Some, and is consequently subject to similar caveats.

Trait Implementations

impl Debug for Symbol

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

Auto Trait Implementations

impl !Send for Symbol

impl !Sync for Symbol

impl Freeze for Symbol

impl RefUnwindSafe for Symbol

impl Unpin for Symbol

impl UnsafeUnpin for Symbol

impl UnwindSafe for Symbol

Blanket Implementations

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Symbol where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Symbol where T: ?Sized,

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

impl<T> From<T> for Symbol

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for Symbol where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Symbol

impl<T, U> Into<U> for Symbol where U: From<T>,

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

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for Symbol where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>