[][src]Struct string_err::StringError

pub struct StringError<E: ?Sized, B: MaybeBacktrace = ()> { /* fields omitted */ }

The string error type

See the crate documentation for examples on how to use this type.

Methods

impl StringError<(), ()>[src]

pub fn new(msg: impl Into<String>) -> Self[src]

Creates a new string error with no underlying error nor backtrace

This is not recommended to be used unless you really don't have an underlying error, and even so, it might be more useful to use StringError::with_backtrace, as at least you would have some reference.

impl StringError<(), Backtrace>[src]

pub fn with_backtrace(msg: impl Into<String>) -> Self[src]

Creates a new string error with no underlying error, but with a backtrace

This is reccomended only when you don't have an underlying error.

impl<E: Sized> StringError<E, ()>[src]

pub fn with_err<R: Into<E>>(msg: impl Into<String>) -> impl FnOnce(R) -> Self[src]

Returns a function to be passed to map_err, map_panic_err or alike that returns a string error with the underlying error but no backtrace

impl<E: Sized> StringError<E, Backtrace>[src]

pub fn with_err_backtrace<R: Into<E>>(
    msg: impl Into<String>
) -> impl FnOnce(R) -> Self
[src]

Returns a function to be passed to map_err, map_panic_err or alike that returns a string error with the underlying error and a backtrace

impl<E: ?Sized, B: MaybeBacktrace> StringError<E, B>[src]

#[must_use]pub fn msg(&self) -> &str[src]

Returns the current message within this error

#[must_use]pub fn err(&self) -> &E[src]

Returns the current underlying error within error

#[must_use]pub fn backtrace_maybe(&self) -> Option<&Backtrace>[src]

Returns the backtrace, if any

impl<E: ?Sized> StringError<E, Backtrace>[src]

#[must_use]pub const fn backtrace(&self) -> &Backtrace[src]

Returns the existing backtrace

Trait Implementations

impl<E: ?Sized, B: MaybeBacktrace> Debug for StringError<E, B>[src]

Default Debug impl for all StringError<E, B>

impl<E: Sized + Debug, B: MaybeBacktrace> Debug for StringError<E, B>[src]

Specialiation Debug impl for E: Sized + Debug

impl<E: Default + ?Sized, B: Default + MaybeBacktrace> Default for StringError<E, B>[src]

impl<E: ?Sized, B: MaybeBacktrace> Display for StringError<E, B>[src]

Display implementation for all StringError<E, B>

impl<E: Eq + ?Sized, B: Eq + MaybeBacktrace> Eq for StringError<E, B>[src]

impl<E: ?Sized, B: MaybeBacktrace> Error for StringError<E, B>[src]

Default Error impl for any all StringError<E, B>

impl<E: Error + 'static, B: MaybeBacktrace> Error for StringError<E, B>[src]

Specialization Error implementation for Error + 'static types Note: E can't be ?Sized because the pointer we'd return is a fat pointer with the size and the vtable, which itself is ?Sized

fn source(&self) -> Option<&(dyn Error + 'static)>[src]

Note: Not default because if we do have a Error + 'static underlying error, we can always return it.

impl<E: Hash + ?Sized, B: Hash + MaybeBacktrace> Hash for StringError<E, B>[src]

impl<E: PartialEq + ?Sized, B: PartialEq + MaybeBacktrace> PartialEq<StringError<E, B>> for StringError<E, B>[src]

impl<E: ?Sized, B: MaybeBacktrace> StructuralEq for StringError<E, B>[src]

impl<E: ?Sized, B: MaybeBacktrace> StructuralPartialEq for StringError<E, B>[src]

Auto Trait Implementations

impl<E: ?Sized, B> RefUnwindSafe for StringError<E, B> where
    B: RefUnwindSafe,
    E: RefUnwindSafe

impl<E: ?Sized, B> Send for StringError<E, B> where
    B: Send,
    E: Send

impl<E: ?Sized, B> Sync for StringError<E, B> where
    B: Sync,
    E: Sync

impl<E: ?Sized, B> Unpin for StringError<E, B> where
    B: Unpin,
    E: Unpin

impl<E: ?Sized, B> UnwindSafe for StringError<E, B> where
    B: UnwindSafe,
    E: UnwindSafe

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> 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.