pub struct Trace<T>(/* private fields */);Expand description
Wrapper type containing a value and the backtrace to the address where it was wrapped.
It is transparent and forwards Hash, PartialOrd, Ord, PartialEq and Eq to the
wrapped type. Deref and DerefMut implementations are provided to make it somewhat easy
to work with the contained type.
Implementations§
Source§impl<T> Trace<T>
impl<T> Trace<T>
Sourcepub fn new(t: T) -> Self
pub fn new(t: T) -> Self
Creates a new stack-trace wrapping a value.
use debugtrace::Trace;
fn foo() -> Trace<()> {
Trace::new(())
}
let t = foo();
// Prints "() at:" followed by a backtrace in debug and test profiles
// Will also print the backtrace if the `backtrace` feature is on
// independent of profile
println!("{:?}", t);Trait Implementations§
Source§impl<T: Debug> Debug for Trace<T>
Implementation of debug which debug-prints the inner type followed by the stacktrace to the
address where the Trace was created.
impl<T: Debug> Debug for Trace<T>
Implementation of debug which debug-prints the inner type followed by the stacktrace to the
address where the Trace was created.
Source§impl<T> From<T> for Trace<T>
Enables any error to automatically be wrapped in Trace<E> when Result<T, E> is used in
the try! macro.
impl<T> From<T> for Trace<T>
Enables any error to automatically be wrapped in Trace<E> when Result<T, E> is used in
the try! macro.
Source§impl<T: Ord> Ord for Trace<T>
impl<T: Ord> Ord for Trace<T>
Source§impl<T: PartialOrd> PartialOrd for Trace<T>
impl<T: PartialOrd> PartialOrd for Trace<T>
impl<T: Eq> Eq for Trace<T>
Auto Trait Implementations§
impl<T> Freeze for Trace<T>where
T: Freeze,
impl<T> RefUnwindSafe for Trace<T>where
T: RefUnwindSafe,
impl<T> !Send for Trace<T>
impl<T> !Sync for Trace<T>
impl<T> Unpin for Trace<T>where
T: Unpin,
impl<T> UnwindSafe for Trace<T>where
T: UnwindSafe,
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