Struct Backtrace
#[must_use]
pub struct Backtrace { pub(in ::backtrace) inner: Inner }
A captured OS thread stack backtrace.
This type represents a stack backtrace for an OS thread captured at a
previous point in time. In some instances the Backtrace type may
internally be empty due to configuration. For more information see
Backtrace::capture.
Fields
inner: Inner
Implementations
impl Backtrace
fn enabled() -> boolReturns whether backtrace captures are enabled through environment variables.
fn capture() -> BacktraceCaptures a stack backtrace of the current thread.
This function will capture a stack backtrace of the current OS thread of execution, returning a
Backtracetype which can be later used to print the entire stack trace or render it to a string.This function will be a noop if the
RUST_BACKTRACEorRUST_LIB_BACKTRACEbacktrace variables are both not set. If either environment variable is set and enabled then this function will actually capture a backtrace. Capturing a backtrace can be both memory intensive and slow, so these environment variables allow liberally usingBacktrace::captureand only incurring a slowdown when the environment variables are set.To forcibly capture a backtrace regardless of environment variables, use the
Backtrace::force_capturefunction.fn force_capture() -> BacktraceForcibly captures a full backtrace, regardless of environment variable configuration.
This function behaves the same as
captureexcept that it ignores the values of theRUST_BACKTRACEandRUST_LIB_BACKTRACEenvironment variables, always capturing a backtrace.Note that capturing a backtrace can be an expensive operation on some platforms, so this should be used with caution in performance-sensitive parts of code.
const fn disabled() -> BacktraceForcibly captures a disabled backtrace, regardless of environment variable configuration.
fn create(ip: usize) -> Backtracefn status(&self) -> BacktraceStatusReturns the status of this backtrace, indicating whether this backtrace request was unsupported, disabled, or a stack trace was actually captured.
impl<'a> Backtrace
fn frames(&'a self) -> &'a [BacktraceFrame]Returns an iterator over the backtrace frames.
Trait Implementations
impl Debug for Backtrace
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result
impl Display for Backtrace
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl !Freeze for Backtrace
impl RefUnwindSafe for Backtrace
impl Send for Backtrace
impl Sync for Backtrace
impl Unpin for Backtrace
impl UnsafeUnpin for Backtrace
impl UnwindSafe for Backtrace
Blanket Implementations
impl<T> Any for Backtrace
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Backtrace
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Backtrace
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Backtrace
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Backtrace
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Backtrace
impl<T> ToString for Backtrace
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for Backtrace
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Backtrace
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Backtrace
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>