Struct ComponentCreationError

Source
pub struct ComponentCreationError { /* private fields */ }
Expand description

Creating a (header field) component from the given data failed

A good example converting a string to a mailbox by parsing it, or more concretely failing to do so because it’s not a valid mail address.

Implementations§

Source§

impl ComponentCreationError

Source

pub fn from_parent<P>(parent: P, component: &'static str) -> Self
where P: Into<FError>,

create a new ComponentCreationError based on a different error and the name of the component

The name is normally the type name, for example Email, Mailbox etc.

Source

pub fn new(component: &'static str) -> Self

creates a new ComponentCreationError based on the components name

The name is normally the type name, for example Email, Mailbox etc.

Source

pub fn new_with_str<I>(component: &'static str, str_context: I) -> Self
where I: Into<String>,

creates a new ComponentCreationError based on the components name with a str_context

The name is normally the type name, for example Email, Mailbox etc.

The str_context is a snipped of text which can help a human to identify the invalid parts, e.g. for parsing a email it could be the invalid email address.

Source

pub fn str_context(&self) -> Option<&str>

Source

pub fn set_str_context<I>(&mut self, ctx: I)
where I: Into<String>,

Source

pub fn with_str_context<I>(self, ctx: I) -> Self
where I: Into<String>,

Trait Implementations§

Source§

impl Debug for ComponentCreationError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ComponentCreationError

Source§

fn fmt(&self, fter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Fail for ComponentCreationError

Source§

fn cause(&self) -> Option<&dyn Fail>

Returns a reference to the underlying cause of this failure, if it is an error that wraps other errors. Read more
Source§

fn backtrace(&self) -> Option<&Backtrace>

Returns a reference to the Backtrace carried by this failure, if it carries one. Read more
Source§

fn name(&self) -> Option<&str>

Returns the “name” of the error. Read more
Source§

fn context<D>(self, context: D) -> Context<D>
where D: Display + Send + Sync + 'static, Self: Sized,

Provides context for this failure. Read more
Source§

fn compat(self) -> Compat<Self>
where Self: Sized,

Wraps this failure in a compatibility wrapper that implements std::error::Error. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsFail for T
where T: Fail,

Source§

fn as_fail(&self) -> &(dyn Fail + 'static)

Converts a reference to Self into a dynamic trait object of Fail.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HeaderTryFrom<T> for T

Source§

impl<F, T> HeaderTryInto<T> for F
where T: HeaderTryFrom<F>,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Erased for T