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() -> Backtrace

Captures a stack backtrace of the current thread.

This function will capture a stack backtrace of the current OS thread of execution, returning a Backtrace type 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_BACKTRACE or RUST_LIB_BACKTRACE backtrace 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 using Backtrace::capture and only incurring a slowdown when the environment variables are set.

To forcibly capture a backtrace regardless of environment variables, use the Backtrace::force_capture function.

fn force_capture() -> Backtrace

Forcibly captures a full backtrace, regardless of environment variable configuration.

This function behaves the same as capture except that it ignores the values of the RUST_BACKTRACE and RUST_LIB_BACKTRACE environment 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() -> Backtrace

Forcibly captures a disabled backtrace, regardless of environment variable configuration.

fn status(self: &Self) -> BacktraceStatus

Returns 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) -> T

Returns the argument unchanged.

impl<T> ToString for Backtrace

fn to_string(self: &Self) -> String

impl<T, U> Into for Backtrace

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses 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>