pub enum Value<T, B: BoundaryKind = GenericBoundary> {
Interior(T),
Boundary {
reason: B,
last: T,
},
}Expand description
The core type. Interior or Boundary. One distinction. Every domain.
Variants§
Interior(T)
Interior: the value is in safe territory.
Boundary
Boundary: the value crossed the edge. Carries the reason and last known value.
Implementations§
Source§impl<T, B: BoundaryKind> Value<T, B>
impl<T, B: BoundaryKind> Value<T, B>
Sourcepub fn boundary(reason: B, last: T) -> Self
pub fn boundary(reason: B, last: T) -> Self
Construct a boundary value with a reason and last known value.
pub fn is_interior(&self) -> bool
pub fn is_boundary(&self) -> bool
Sourcepub fn map<U>(self, f: impl FnOnce(T) -> U) -> Value<U, B>
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> Value<U, B>
Map over the interior value. Boundaries propagate unchanged.
Sourcepub fn propagate(self) -> Result<T, B>
pub fn propagate(self) -> Result<T, B>
Extract the interior value, or return the boundary reason as Err
for ? propagation. The residual is not carried through propagation —
match explicitly to access it.
Trait Implementations§
Auto Trait Implementations§
impl<T, B> Freeze for Value<T, B>
impl<T, B> RefUnwindSafe for Value<T, B>where
T: RefUnwindSafe,
B: RefUnwindSafe,
impl<T, B> Send for Value<T, B>where
T: Send,
impl<T, B> Sync for Value<T, B>where
T: Sync,
impl<T, B> Unpin for Value<T, B>
impl<T, B> UnsafeUnpin for Value<T, B>where
T: UnsafeUnpin,
B: UnsafeUnpin,
impl<T, B> UnwindSafe for Value<T, B>where
T: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
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