Struct ExpectationChain

Source
pub struct ExpectationChain<'a, T> { /* private fields */ }

Implementations§

Source§

impl<'a, T> ExpectationChain<'a, T>

Source

pub fn from_expression(expression: ExpressionUnderTest<'a, T>) -> Self

Source

pub fn not(self) -> Self

Source

pub fn and(self) -> Self

Source

pub fn expecting(self, expectation: impl Expectation<T> + 'a) -> Self

Source

pub fn failure(self, message: String) -> Self

Source

pub fn soft(self) -> Self

Source

pub fn conclude_result(self) -> Result<(), String>

Source

pub fn conclude_panic(self)

Trait Implementations§

Source§

impl<'a> BoolExpectationsExt<'a> for ExpectationChain<'a, bool>

Source§

fn to_be_true(self) -> ExpectationChain<'a, bool>

Asserts that the tested expression evaluates to true.
Source§

fn to_be_false(self) -> ExpectationChain<'a, bool>

Asserts that the tested expression evaluates to false.
Source§

impl<'a, T> CustomFnExpectationsExt<'a, T> for ExpectationChain<'a, T>

Source§

fn to<F: 'a + FnOnce(&T) -> bool>( self, message: &str, expectation_fn: F, ) -> ExpectationChain<'a, T>

Asserts that the actual value satisfies some expectation, given in the form of a custom function. This expectation function shall return false if the expectation does not hold and true otherwise. In the former case, rassert will display the supplied message string.
Source§

impl<'a, T> EqualityExpectationsExt<'a, T> for ExpectationChain<'a, T>
where T: PartialEq + Debug,

Source§

fn to_equal(self, expected: &'a T) -> ExpectationChain<'a, T>

Asserts that the actual value is equal to the [expected] value. The same as the to_be function.
Source§

fn to_be(self, expected: &'a T) -> ExpectationChain<'a, T>

Asserts that the actual value is equal to the [expected] value. The same as the to_equal function.
Source§

fn to_not_equal(self, expected: &'a T) -> ExpectationChain<'a, T>

Asserts that the actual value is not equal to the [expected] value. The same as the to_not_be function.
Source§

fn to_not_be(self, expected: &'a T) -> ExpectationChain<'a, T>

Asserts that the actual value is not equal to the [expected] value. The same as the to_not_equal function.
Source§

impl<'a, T> OptionExpectationsExt<'a, T> for ExpectationChain<'a, Option<T>>

Source§

fn to_be_some(self) -> ExpectationChain<'a, Option<T>>

Asserts that the tested Option holds Some value.
Source§

fn to_be_none(self) -> ExpectationChain<'a, Option<T>>

Asserts that the tested Option is None.
Source§

impl<'a, T> OptionItemExpectationsExt<'a, T> for ExpectationChain<'a, Option<T>>
where T: Debug + PartialEq,

Source§

fn to_contain(self, expected: &'a T) -> ExpectationChain<'a, Option<T>>

Asserts that the actual Option holds Some(expected).
Source§

impl<'a, T, E> ResultExpectationsExt<'a, T, E> for ExpectationChain<'a, Result<T, E>>

Source§

fn to_be_ok(self) -> ExpectationChain<'a, Result<T, E>>

Asserts that the tested Result is Ok(..).
Source§

fn to_be_err(self) -> ExpectationChain<'a, Result<T, E>>

Asserts that the tested Result is Err(..).
Source§

impl<'a, T, E> ResultOkExpectationsExt<'a, T, E> for ExpectationChain<'a, Result<T, E>>
where T: Debug + PartialEq,

Source§

fn to_be_ok_with(self, expected: &'a T) -> ExpectationChain<'a, Result<T, E>>

Source§

impl<'a, T> VectorExpectationsExt<'a, T> for ExpectationChain<'a, Vec<T>>

Source§

fn to_have_length(self, expected: usize) -> ExpectationChain<'a, Vec<T>>

Asserts that the length of the tested vector is equal to [expected].
Source§

fn to_be_empty(self) -> ExpectationChain<'a, Vec<T>>

Asserts that the tested vector is empty.
Source§

fn to_be_non_empty(self) -> ExpectationChain<'a, Vec<T>>

Asserts that the tested vector is not empty (it contains at least one item).
Source§

impl<'a, T> VectorItemExpectationsExt<'a, T> for ExpectationChain<'a, Vec<T>>
where T: Debug + PartialEq,

Source§

fn to_contain(self, expected: &'a T) -> ExpectationChain<'a, Vec<T>>

Asserts that the tested vec contains [expected].

Auto Trait Implementations§

§

impl<'a, T> Freeze for ExpectationChain<'a, T>

§

impl<'a, T> !RefUnwindSafe for ExpectationChain<'a, T>

§

impl<'a, T> !Send for ExpectationChain<'a, T>

§

impl<'a, T> !Sync for ExpectationChain<'a, T>

§

impl<'a, T> Unpin for ExpectationChain<'a, T>

§

impl<'a, T> !UnwindSafe for ExpectationChain<'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.