pub struct Trace(/* private fields */);
Expand description
A backtrace-like structure to store traces.
Implementations§
Source§impl Trace
impl Trace
Sourcepub fn iter(&self) -> TraceIter<'_> ⓘ
pub fn iter(&self) -> TraceIter<'_> ⓘ
Get an iterator over all traces.
The returned iterator iterates over all traces in the reverse order they
were add
ed.
§Example
let mut trace = Trace::new();
trace.add("item 1");
trace.add("item 2");
let mut iter = trace.iter().map(|x| x.to_string());
assert_eq!(iter.next().as_deref(), Some("item 2"));
assert_eq!(iter.next().as_deref(), Some("item 1"));
assert_eq!(iter.next(), None);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Trace
impl !RefUnwindSafe for Trace
impl Send for Trace
impl Sync for Trace
impl Unpin for Trace
impl !UnwindSafe for Trace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more