Struct debugtrace::Trace [] [src]

pub struct Trace<T>(_, _);

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.

Methods

impl<T> Trace<T>
[src]

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);

Discards the information about where this trace was constructed and yields the wrapped data.

use debugtrace::Trace;

let t = Trace::new("my error");

assert_eq!(t.unwrap(), "my error");

Trait Implementations

impl<T: Clone> Clone for Trace<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T> From<T> for Trace<T>
[src]

Enables any error to automatically be wrapped in Trace<E> when Result<T, E> is used in the try! macro.

Performs the conversion.

impl<T: Debug> Debug for Trace<T>
[src]

Implementation of debug which debug-prints the inner type followed by the stacktrace to the address where the Trace was created.

Formats the value using the given formatter.

impl<T> Deref for Trace<T>
[src]

The resulting type after dereferencing

The method called to dereference a value

impl<T> DerefMut for Trace<T>
[src]

The method called to mutably dereference a value

impl<T: Hash> Hash for Trace<T>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: PartialOrd> PartialOrd for Trace<T>
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Ord> Ord for Trace<T>
[src]

This method returns an Ordering between self and other. Read more

impl<T: PartialEq> PartialEq<Trace<T>> for Trace<T>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T: Eq> Eq for Trace<T>
[src]