Struct neodyn_xc::error::Error[][src]

#[must_use]pub struct Error { /* fields omitted */ }

The central error type for Neodyn Exchange.

Implementations

impl Error[src]

pub fn new<S>(message: S) -> Self where
    S: Into<Cow<'static, str>>, 
[src]

Creates an error with the specified message, no cause, and a backtrace.

let error = Error::new("sample error message");
assert!(error.to_string().contains("sample error message"));
assert!(error.reason().is_none());
assert!(error.stack_trace().is_some());

pub fn with_cause<S, E>(message: S, cause: E) -> Self where
    S: Into<Cow<'static, str>>,
    E: ErrorExt + 'static, 
[src]

Creates an error with the specified message and cause. If the cause has no backtrace, this method will create it and add it to the new instance.


let cause = "not a bool".parse::<bool>().unwrap_err();
assert!(cause.cause().is_none());
assert!(cause.stack_trace().is_none());

let error = Error::with_cause("top-level message", cause);
assert!(error.to_string().contains("top-level message"));
assert!(error.cause().unwrap().to_string().contains(
    "provided string was not `true` or `false`"
));
assert!(error.stack_trace().is_some());

#[must_use]pub fn context<K>(&self) -> Option<&K::Value> where
    K: Key,
    K::Value: Debug + Send + Sync
[src]

Returns additional context info if any.

pub fn set_context<K>(&mut self, value: K::Value) -> Option<K::Value> where
    K: Key,
    K::Value: Debug + Send + Sync
[src]

Augments the error with additional context info.

pub fn with_context<K>(self, value: K::Value) -> Self where
    K: Key,
    K::Value: Debug + Send + Sync
[src]

Builder-style setter for agumenting the error with context info.

Trait Implementations

impl Debug for Error[src]

impl Display for Error[src]

Displays the error. If the alternate flag ({:#}) is set, also prints the full stack trace.

impl Error for Error[src]

impl Error for Error[src]

impl Error for Error[src]

TODO(H2CO3): implement the rest of the (provided) methods by retaining the structured information itself, not only the formatted error message.

impl ErrorExt for Error[src]

impl From<Error> for Error[src]

impl From<FloatIsNan> for Error[src]

impl From<FromUtf8Error> for Error[src]

impl From<ParseBoolError> for Error[src]

impl From<ParseFloatError> for Error[src]

impl From<ParseIntError> for Error[src]

impl From<ParseNotNanError<ParseFloatError>> for Error[src]

impl From<TryFromIntError> for Error[src]

impl From<Utf8Error> for Error[src]

impl<'de> IntoDeserializer<'de, Error> for Value[src]

type Deserializer = Self

The type of the deserializer being converted into.

impl<'de> IntoDeserializer<'de, Error> for &'de Value[src]

type Deserializer = Self

The type of the deserializer being converted into.

Auto Trait Implementations

impl !RefUnwindSafe for Error

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl !UnwindSafe for Error

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DebugAny for T where
    T: Any + Debug
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> UnsafeAny for T where
    T: Any