Struct trust_dns_proto::error::ExtBacktrace
source · [−]pub struct ExtBacktrace { /* private fields */ }
backtrace
only.Expand description
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.
Backtrace
supports pretty-printing of backtraces through its Debug
implementation.
Required features
This function requires the std
feature of the backtrace
crate to be
enabled, and the std
feature is enabled by default.
Implementations
sourceimpl Backtrace
impl Backtrace
sourcepub fn new() -> Backtrace
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.
Note that on some platforms acquiring a full backtrace and resolving it
can be extremely expensive. If the cost is too much for your application
it’s recommended to instead use Backtrace::new_unresolved()
which
avoids the symbol resolution step (which typically takes the longest)
and allows deferring that to a later date.
Examples
use backtrace::Backtrace;
let current_backtrace = Backtrace::new();
Required features
This function requires the std
feature of the backtrace
crate to be
enabled, and the std
feature is enabled by default.
sourcepub fn new_unresolved() -> Backtrace
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
Required features
This function requires the std
feature of the backtrace
crate to be
enabled, and the std
feature is enabled by default.
sourcepub fn frames(&self) -> &[BacktraceFrame]
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.
Required features
This function requires the std
feature of the backtrace
crate to be
enabled, and the std
feature is enabled by default.
sourcepub fn resolve(&mut self)
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.
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
Auto Trait Implementations
impl RefUnwindSafe for Backtrace
impl Send for Backtrace
impl Sync for Backtrace
impl Unpin for Backtrace
impl UnwindSafe for Backtrace
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more