Enum tear::ValRet [−][src]
Represents a usable value or an early return. Use with tear!
Description
The idea is to type an early return. The early return either evaluates to something (Val) or returns early (Ret).
Variants
The usable value
The return value
Implementations
impl<V, R> ValRet<V, R>
[src]
NB: Other combinators such as and
, and_then
, or
, map_val
aren’t implemented because I didn’t need them, not because they aren’t useful.
Examples will all use the following two variables
let ok: ValRet<&str, &str> = Val("ok"); let error: ValRet<&str, &str> = Ret("error");
pub fn val(self) -> Option<V>
[src]
Gets the Val(V)
variant as Option<V>
pub fn ret(self) -> Option<R>
[src]
Gets the Ret(R)
variant as Option<R>
Trait Implementations
impl<V: Clone, R: Clone> Clone for ValRet<V, R>
[src]
fn clone(&self) -> ValRet<V, R>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<V: Debug, R: Debug> Debug for ValRet<V, R>
[src]
impl<T, R> Judge for ValRet<T, R>
[src]
type Positive = T
This is considered Good
type Negative = R
This is considered Bad
fn into_moral(self) -> Moral<T, R>
[src]
fn from_good(v: T) -> Self
[src]
fn from_bad(r: R) -> Self
[src]
fn result(self) -> Result<Self::Positive, Self::Negative>
[src]
impl<V: PartialEq, R: PartialEq> PartialEq<ValRet<V, R>> for ValRet<V, R>
[src]
impl<V, R> StructuralPartialEq for ValRet<V, R>
[src]
Auto Trait Implementations
impl<V, R> Send for ValRet<V, R> where
R: Send,
V: Send,
R: Send,
V: Send,
impl<V, R> Sync for ValRet<V, R> where
R: Sync,
V: Sync,
R: Sync,
V: Sync,
impl<V, R> Unpin for ValRet<V, R> where
R: Unpin,
V: Unpin,
R: Unpin,
V: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, E, Me> Return for Me where
Me: Judge<Positive = T, Negative = E>,
[src]
Me: Judge<Positive = T, Negative = E>,
type Value = T
The Val in ValRet
type Returned = E
The Ret in ValRet
pub fn into_valret(Self) -> ValRet<T, E>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,