#[doc(hidden)]pub enum Prepared<T, E = <T as TryFromSexp>::Error> {
Unprepared,
Ready(T),
Failed(E),
Deferred {
borrow: Option<NativeBorrow>,
arms: Arms,
},
Undecided(Option<NativeBorrow>),
}Expand description
An argument’s conversion as a generated wrapper’s alias check leaves it:
T’s, whose conversion error is E.
The type has no TryFromSexp bound, so a wrapper can declare and read
the state of an argument whose type has no conversion without a second
error: convert reports it, at the type.
Variants§
Unprepared
Not prepared: it converts after the check, which takes its declared metadata.
Ready(T)
Converted during preparation and borrows nothing native: the value is the argument.
Failed(E)
Failed during preparation. The error is reported where the argument converts, so the order of argument errors does not change.
Deferred
A borrowing arm will convert: borrow is all it borrows, arms the
way to it. Its reference is built after the check.
Fields
borrow: Option<NativeBorrow>What the selected arm borrows.
Undecided(Option<NativeBorrow>)
The arm could not be learned without building a reference: it
converts after the check, which takes borrow (every arm it may
still take).
Implementations§
Source§impl<T: TryFromSexp> Prepared<T>
impl<T: TryFromSexp> Prepared<T>
Source§impl<T, E> Prepared<T, E>
impl<T, E> Prepared<T, E>
Sourcepub fn from_result(result: Result<T, E>) -> Self
pub fn from_result(result: Result<T, E>) -> Self
An owned conversion’s result.
Sourcepub fn borrow(&self, declared: Option<NativeBorrow>) -> Option<NativeBorrow>
pub fn borrow(&self, declared: Option<NativeBorrow>) -> Option<NativeBorrow>
What the argument borrows for the second pass of the check, given its declared metadata.
Sourcepub fn map<U: TryFromSexp>(
self,
value: impl FnOnce(T) -> U,
error: impl FnOnce(E) -> U::Error,
) -> Prepared<U>
pub fn map<U: TryFromSexp>( self, value: impl FnOnce(T) -> U, error: impl FnOnce(E) -> U::Error, ) -> Prepared<U>
The preparation of a type that wraps T: value and error build
its value and error, and its __mx_materialize must follow the same
arms through T’s.
Sourcepub fn arm<U: TryFromSexp>(
self,
right: bool,
value: impl FnOnce(T) -> U,
either: Option<NativeBorrow>,
) -> Prepared<U>
pub fn arm<U: TryFromSexp>( self, right: bool, value: impl FnOnce(T) -> U, either: Option<NativeBorrow>, ) -> Prepared<U>
This preparation as one arm of an Either (right for the right
arm), whose own metadata is either.
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.