Struct backtrace::Backtrace
[−]
[src]
pub struct Backtrace { /* fields omitted */ }
Representation of an owned and self-contained backtrace.
This structure can be used to capture a backtrace at various points in a program and later used to inspect what the backtrace was at that time.
Methods
impl Backtrace
[src]
impl Backtrace
pub fn new() -> Backtrace
[src]
pub fn new() -> Backtrace
Captures a backtrace at the callsite of this function, returning an owned representation.
This function is useful for representing a backtrace as an object in Rust. This returned value can be sent across threads and printed elsewhere, and the purpose of this value is to be entirely self contained.
Examples
use backtrace::Backtrace; let current_backtrace = Backtrace::new();
pub fn new_unresolved() -> Backtrace
[src]
pub fn new_unresolved() -> Backtrace
Similar to new
except that this does not resolve any symbols, this
simply captures the backtrace as a list of addresses.
At a later time the resolve
function can be called to resolve this
backtrace's symbols into readable names. This function exists because
the resolution process can sometimes take a significant amount of time
whereas any one backtrace may only be rarely printed.
Examples
use backtrace::Backtrace; let mut current_backtrace = Backtrace::new_unresolved(); println!("{:?}", current_backtrace); // no symbol names current_backtrace.resolve(); println!("{:?}", current_backtrace); // symbol names now present
pub fn frames(&self) -> &[BacktraceFrame]
[src]
pub fn frames(&self) -> &[BacktraceFrame]
Returns the frames from when this backtrace was captured.
The first entry of this slice is likely the function Backtrace::new
,
and the last frame is likely something about how this thread or the main
function started.
pub fn resolve(&mut self)
[src]
pub fn resolve(&mut self)
If this backtrace was created from new_unresolved
then this function
will resolve all addresses in the backtrace to their symbolic names.
If this backtrace has been previously resolved or was created through
new
, this function does nothing.
Trait Implementations
impl Clone for Backtrace
[src]
impl Clone for Backtrace
fn clone(&self) -> Backtrace
[src]
fn clone(&self) -> Backtrace
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl From<Vec<BacktraceFrame>> for Backtrace
[src]
impl From<Vec<BacktraceFrame>> for Backtrace
fn from(frames: Vec<BacktraceFrame>) -> Self
[src]
fn from(frames: Vec<BacktraceFrame>) -> Self
Performs the conversion.
impl Into<Vec<BacktraceFrame>> for Backtrace
[src]
impl Into<Vec<BacktraceFrame>> for Backtrace
fn into(self) -> Vec<BacktraceFrame>
[src]
fn into(self) -> Vec<BacktraceFrame>
Performs the conversion.
impl Debug for Backtrace
[src]
impl Debug for Backtrace
fn fmt(&self, fmt: &mut Formatter) -> Result
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Backtrace
[src]
impl Default for Backtrace