Skip to main content

Mojo struct

StackTrace

@register_passable struct StackTrace

Holds a stack trace of a location when StackTrace is constructed.

Fields

  • value (ArcPointer[UnsafePointer[SIMD[uint8, 1]]]): A reference counting pointer to a char array containing the stack trace.

Implemented traits

AnyType, Copyable, Stringable, UnknownDestructibility

Methods

__init__

__init__() -> Self

Construct an empty stack trace.

__init__(*, depth: Int) -> Self

Construct a new stack trace.

Args:

  • depth (Int): The depth of the stack trace. When depth is zero, entire stack trace is collected. When depth is negative, no stack trace is collected.

__copyinit__

__copyinit__(existing: Self) -> Self

Creates a copy of an existing stack trace.

Args:

  • existing (Self): The stack trace to copy from.

__str__

__str__(self) -> String

Converts the StackTrace to string representation.

Returns:

String: A String of the stack trace.

Was this page helpful?