Struct Backtrace
struct Backtrace { ... }
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.
Implementations
impl Backtrace
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 status(self: &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(self: &'a Self) -> &'a [BacktraceFrame]Returns an iterator over the backtrace frames.
impl Debug for Backtrace
fn fmt(self: &Self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result
impl Display for Backtrace
fn fmt(self: &Self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result
impl Freeze for Backtrace
impl RefUnwindSafe for Backtrace
impl Send for Backtrace
impl Sync for Backtrace
impl Unpin for Backtrace
impl UnwindSafe for Backtrace
impl<T> Any for Backtrace
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Backtrace
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Backtrace
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for Backtrace
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToString for Backtrace
fn to_string(self: &Self) -> String
impl<T, U> Into for Backtrace
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Backtrace
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Backtrace
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>