use backtrace::BacktraceSymbol; use std::fmt; use std::hash::{Hash, Hasher}; use std::ptr;
/// A symbol in a backtrace. /// /// This wrapper type serves two purposes. The first is that it provides a /// representation of a symbol that can be inserted into hashmaps and hashsets; /// the [`backtrace`] crate does not define [`Hash`], [`PartialEq`], or [`Eq`] /// on [`BacktraceSymbol`], and recommends that users define their own wrapper /// which implements these traits. /// /// Second, this wrapper includes a `parent_hash` field that uniquely /// identifies this symbol's position in its trace. Otherwise, e.g., our code /// would not be able to distinguish between recursive calls of a function at /// different depths. #[derive(Clone)] pub(super) struct Symbol { pub(super) symbol: BacktraceSymbol, pub(super) parent_hash: u64,
}
impl Hash for Symbol { fn hash<H>(&self, state: &mut H) where
H: Hasher,
{ iflet Some(name) = self.symbol.name() {
name.as_bytes().hash(state);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.