Struct contrafact::Check [−][src]
#[must_use = "Check should be used with either `.unwrap()` or `.result()`"]pub struct Check { /* fields omitted */ }
Expand description
The result of a check operation, which contains an error message for every constraint which was not met.
Implementations
impl Check
[src]
impl Check
[src]pub fn map<F>(self, f: F) -> Self where
F: FnMut(String) -> String,
[src]
pub fn map<F>(self, f: F) -> Self where
F: FnMut(String) -> String,
[src]Map over each error string. Useful for combinators which add additional context to errors produced by inner facts.
pub fn result(self) -> Result<(), Vec<String>>
[src]
pub fn result(self) -> Result<(), Vec<String>>
[src]Convert to a Result: No errors => Ok
use contrafact::*; assert_eq!(Check::pass().result(), Ok(())); assert_eq!(Check::fail("message").result(), Err(vec!["message".to_string()]));
pub fn check<S: ToString>(ok: bool, err: S) -> Self
[src]
pub fn check<S: ToString>(ok: bool, err: S) -> Self
[src]Create a single-error failure if predicate is false, otherwise pass
use contrafact::*; assert_eq!(Check::check(true, "message"), Check::pass()); assert_eq!(Check::check(false, "message"), Check::fail("message"));
Trait Implementations
impl IntoIterator for Check
[src]
impl IntoIterator for Check
[src]impl Eq for Check
[src]
impl StructuralEq for Check
[src]
impl StructuralPartialEq for Check
[src]
Auto Trait Implementations
impl RefUnwindSafe for Check
impl Send for Check
impl Sync for Check
impl Unpin for Check
impl UnwindSafe for Check
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more