Trait backtrace::Symbol [] [src]

pub trait Symbol {
    fn name(&self) -> Option<&[u8]> { ... }
    fn addr(&self) -> Option<*mut c_void> { ... }
    fn filename(&self) -> Option<&[u8]> { ... }
    fn lineno(&self) -> Option<u32> { ... }
}

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 funciton, 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.

Provided Methods

fn name(&self) -> Option<&[u8]>

Returns the name of this function as a byte array (may not always be valid UTF-8).

fn addr(&self) -> Option<*mut c_void>

Returns the starting address of this function.

fn filename(&self) -> Option<&[u8]>

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.

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
[src]

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

Formats the value using the given formatter.

Implementors