[][src]Struct fluid::core::should::Should

#[must_use]
pub struct Should<L>(_)
where
    L: Debug
;

Main data structure used to create assertions. See its methods for more information about the existing assertions.

Methods

impl<L: Debug> Should<L>[src]

pub fn be_equal_to<R: Debug>(self, right: R) -> ChainableAssert<BeEqualTo<L, R>> where
    L: PartialEq<R>, 
[src]

Checks if the left field is equal to the right field.

Example

fn the_answer() -> i32 {
    42
}

the_answer().should().be_equal_to(42);

impl Should<bool>[src]

pub fn be_true(self) -> ChainableAssert<Boolean>[src]

Checks if a bool is true.

Example

let is_ok = true;
is_ok.should().be_true();

pub fn be_false(self) -> ChainableAssert<Boolean>[src]

Checks if a bool is false.

Example

let is_ok = false;
is_ok.should().be_false();

impl<L: Debug> Should<L>[src]

pub fn have_the_property<F>(
    self,
    closure: F
) -> ChainableAssert<HaveProperty<L, F>> where
    F: FnOnce(&L) -> bool
[src]

Checks if a user-defined property is satisfied.

Example

fn an_even_number() -> i32 { 2 }

an_even_number().should().have_the_property(|&n| n % 2 == 0);

impl<I: Debug> Should<I> where
    I: IntoIterator,
    I::Item: PartialEq<I::Item> + Debug,
    I::IntoIter: Debug
[src]

pub fn yield_the_item(
    self,
    right: I::Item
) -> ConsumingAssert<ContainIterator<I::IntoIter>>
[src]

Checks if an iterator contains the right field.

Example

let it = vec![1, 2, 3, 4].into_iter();

it.should().not().yield_the_item(0);

impl<O: Debug, E: Debug> Should<Result<O, E>>[src]

pub fn be_an_error(self) -> ChainableAssert<BeAnError<O, E>>[src]

Checks if a result is an error.

Example

let result = "two".parse::<i32>();
result.should().be_an_error().because("“two“ is not a valid number");

impl<O: Debug, E: Debug> Should<Result<O, E>>[src]

pub fn be_ok(self) -> ChainableAssert<BeOk<O, E>>[src]

Checks if a result is an error.

Example

let result = "2".parse::<i32>();
result.should().be_ok();

Trait Implementations

impl<C: Debug> ShouldCollection<C> for Should<C> where
    C: Collection
[src]

impl<S: Debug> ShouldString<S> for Should<S> where
    S: AsRef<str>, 
[src]

impl<L> Default for Should<L> where
    L: Debug
[src]

impl<L> From<ShouldImpl<L>> for Should<L> where
    L: Debug
[src]

impl<L> From<Should<L>> for ShouldImpl<L> where
    L: Debug
[src]

impl<'a, L> From<&'a mut Should<L>> for &'a mut ShouldImpl<L> where
    L: Debug
[src]

impl<L: Debug> Debug for Should<L> where
    L: Debug
[src]

impl<L> Not for Should<L> where
    L: Debug
[src]

type Output = Self

The resulting type after applying the ! operator.

Auto Trait Implementations

impl<L> Send for Should<L> where
    L: Send

impl<L> Sync for Should<L> where
    L: Sync

Blanket Implementations

impl<L> ShouldExtension for L where
    L: Debug
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]