pub struct Symbol { /* fields omitted */ }
A trait representing the resolution of a symbol in a file.
This trait is yielded as a trait object to the closure given to the
backtrace::resolve
function, and it is virtually dispatched as it's
unknown which implementation is behind it.
A symbol can give contextual information about a function, for example the
name, filename, line number, precise address, etc. Not all information is
always available in a symbol, however, so all methods return an Option
.
Returns the name of this function.
The returned structure can be used to query various properties about the
symbol name:
- The
Display
implementation will print out the demangled symbol.
- The raw
str
value of the symbol can be accessed (if it's valid
utf-8).
- The raw bytes for the symbol name can be accessed.
Returns the starting address of this function.
Returns the file name where this function was defined.
This is currently only available when libbacktrace is being used (e.g.
unix platforms other than OSX) and when a binary is compiled with
debuginfo. If neither of these conditions is met then this will likely
return None
.
Returns the line number for where this symbol is currently executing.
This return value is typically Some
if filename
returns Some
, and
is consequently subject to similar caveats.
Formats the value using the given formatter. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)