[][src]Struct backtrace::Symbol

pub struct Symbol { /* fields omitted */ }

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.

Implementations

impl Symbol[src]

pub fn name(&self) -> Option<SymbolName>[src]

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.

pub fn addr(&self) -> Option<*mut c_void>[src]

Returns the starting address of this function.

pub fn filename_raw(&self) -> Option<BytesOrWideString>[src]

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

pub fn lineno(&self) -> Option<u32>[src]

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.

pub fn filename(&self) -> Option<&Path>[src]

Returns the file name where this function was defined.

This is currently only available when libbacktrace is being used (e.g. unix platforms other than OSX) and when a binary is compiled with debuginfo. If neither of these conditions is met then this will likely return None.

Required features

This function requires the std feature of the backtrace crate to be enabled, and the std feature is enabled by default.

Trait Implementations

impl Debug for Symbol[src]

Auto Trait Implementations

impl RefUnwindSafe for Symbol

impl !Send for Symbol

impl !Sync for Symbol

impl Unpin for Symbol

impl UnwindSafe for Symbol

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.