Struct email::email::message::ouroboros_impl_message::MessageTryBuilder
source · pub(super) struct MessageTryBuilder<'a, ParsedBuilder_: for<'this> FnOnce(&'this mut RawMessage<'a>) -> Result<Option<Message<'this>>, Error_>, Error_> {
pub(super) raw: RawMessage<'a>,
pub(super) parsed_builder: ParsedBuilder_,
}
Expand description
A more verbose but stable way to construct self-referencing structs. It is comparable to using StructName { field1: value1, field2: value2 }
rather than StructName::new(value1, value2)
. This has the dual benefit of makin your code both easier to refactor and more readable. Call try_build()
or try_build_or_recover()
to construct the actual struct. The fields of this struct should be used as follows:
Field | Suggested Use |
---|---|
raw | Directly pass in the value this field should contain |
parsed_builder | Use a function or closure: (raw: &mut _) -> Result<parsed: _, Error_> |
Fields§
§raw: RawMessage<'a>
§parsed_builder: ParsedBuilder_
Implementations§
source§impl<'a, ParsedBuilder_: for<'this> FnOnce(&'this mut RawMessage<'a>) -> Result<Option<Message<'this>>, Error_>, Error_> MessageTryBuilder<'a, ParsedBuilder_, Error_>
impl<'a, ParsedBuilder_: for<'this> FnOnce(&'this mut RawMessage<'a>) -> Result<Option<Message<'this>>, Error_>, Error_> MessageTryBuilder<'a, ParsedBuilder_, Error_>
sourcepub(super) fn try_build(self) -> Result<Message<'a>, Error_>
pub(super) fn try_build(self) -> Result<Message<'a>, Error_>
Calls Message::try_new()
using the provided values. This is preferrable over calling try_new()
directly for the reasons listed above.
sourcepub(super) fn try_build_or_recover(
self
) -> Result<Message<'a>, (Error_, Heads<'a>)>
pub(super) fn try_build_or_recover( self ) -> Result<Message<'a>, (Error_, Heads<'a>)>
Calls Message::try_new_or_recover()
using the provided values. This is preferrable over calling try_new_or_recover()
directly for the reasons listed above.
Auto Trait Implementations§
impl<'a, ParsedBuilder_, Error_> Freeze for MessageTryBuilder<'a, ParsedBuilder_, Error_>where
ParsedBuilder_: Freeze,
impl<'a, ParsedBuilder_, Error_> RefUnwindSafe for MessageTryBuilder<'a, ParsedBuilder_, Error_>where
ParsedBuilder_: RefUnwindSafe,
impl<'a, ParsedBuilder_, Error_> Send for MessageTryBuilder<'a, ParsedBuilder_, Error_>where
ParsedBuilder_: Send,
impl<'a, ParsedBuilder_, Error_> Sync for MessageTryBuilder<'a, ParsedBuilder_, Error_>where
ParsedBuilder_: Sync,
impl<'a, ParsedBuilder_, Error_> Unpin for MessageTryBuilder<'a, ParsedBuilder_, Error_>where
ParsedBuilder_: Unpin,
impl<'a, ParsedBuilder_, Error_> UnwindSafe for MessageTryBuilder<'a, ParsedBuilder_, Error_>where
ParsedBuilder_: UnwindSafe,
Blanket Implementations§
source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
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
source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Approximate the subject to a given type with the default scheme.
source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
Approximate the subject to a given type with a specific scheme.