pub struct Subject<'a, Sub, Opt, Ret> { /* private fields */ }
Expand description
Data structure that contains a value to be tested (actual value) with auxiliary data (ex. line pos, description).
Implementations§
Trait Implementations§
source§impl<R> BooleanAssertion<R> for Subject<'_, bool, (), R>where
AssertionResult: AssertionStrategy<R>,
impl<R> BooleanAssertion<R> for Subject<'_, bool, (), R>where
AssertionResult: AssertionStrategy<R>,
source§impl<'a, R> CheckThatResultAssertion<'a, R> for Subject<'a, CheckThatResult, (), R>where
AssertionResult: AssertionStrategy<R>,
impl<'a, R> CheckThatResultAssertion<'a, R> for Subject<'a, CheckThatResult, (), R>where
AssertionResult: AssertionStrategy<R>,
source§fn facts_are<B: Borrow<Vec<Fact>>>(&self, expected: B) -> R
fn facts_are<B: Borrow<Vec<Fact>>>(&self, expected: B) -> R
Checks that the assertion result contains elements of
facts
in order.source§fn facts_are_at_least<B: Borrow<Vec<Fact>>>(&self, facts: B) -> R
fn facts_are_at_least<B: Borrow<Vec<Fact>>>(&self, facts: B) -> R
Checks that the assertion result contains elements of
facts
in order.source§impl<S: PartialOrd + Debug, R> ComparableAssertion<S, R> for Subject<'_, S, (), R>where
AssertionResult: AssertionStrategy<R>,
impl<S: PartialOrd + Debug, R> ComparableAssertion<S, R> for Subject<'_, S, (), R>where
AssertionResult: AssertionStrategy<R>,
source§fn is_at_least<B: Borrow<S>>(&self, expected: B) -> R
fn is_at_least<B: Borrow<S>>(&self, expected: B) -> R
Checks that the subject is greater than or equal to
expected
.source§fn is_at_most<B: Borrow<S>>(&self, expected: B) -> R
fn is_at_most<B: Borrow<S>>(&self, expected: B) -> R
Checks that the subject is less than or equal to
expected
.source§fn is_greater_than<B: Borrow<S>>(&self, expected: B) -> R
fn is_greater_than<B: Borrow<S>>(&self, expected: B) -> R
Checks that the subject is greater than
expected
.source§fn is_less_than<B: Borrow<S>>(&self, expected: B) -> R
fn is_less_than<B: Borrow<S>>(&self, expected: B) -> R
Checks that the subject is less than
expected
.source§impl<'a, T, Y, R> CowAssertion<T, Y, R> for Subject<'a, Cow<'a, T>, (), R>
impl<'a, T, Y, R> CowAssertion<T, Y, R> for Subject<'a, Cow<'a, T>, (), R>
source§fn is_borrowed(&self) -> R
fn is_borrowed(&self) -> R
Checks that the subject is
Cow::Borrowed(_)
.source§fn is_owned(&self) -> R
fn is_owned(&self) -> R
Checks that the subject is
Cow::Owned(_)
.source§impl<S: PartialEq + Debug, R> EqualityAssertion<S, R> for Subject<'_, S, (), R>where
AssertionResult: AssertionStrategy<R>,
impl<S: PartialEq + Debug, R> EqualityAssertion<S, R> for Subject<'_, S, (), R>where
AssertionResult: AssertionStrategy<R>,
source§fn is_equal_to<B: Borrow<S>>(&self, expected: B) -> R
fn is_equal_to<B: Borrow<S>>(&self, expected: B) -> R
Checks if the subject is equal to
expected
.source§fn is_not_equal_to<B: Borrow<S>>(&self, expected: B) -> R
fn is_not_equal_to<B: Borrow<S>>(&self, expected: B) -> R
Checks if the subject value is NOT equal to
expected
.source§impl<'a, S, R: 'a> FloatAssertion<'a, S, R> for Subject<'a, S, (), R>
impl<'a, S, R: 'a> FloatAssertion<'a, S, R> for Subject<'a, S, (), R>
source§fn with_rel_tol(self, rel_tol: S) -> Subject<'a, S, FloatTolerance<S>, R>
fn with_rel_tol(self, rel_tol: S) -> Subject<'a, S, FloatTolerance<S>, R>
Set the relative tolerance.
source§fn with_abs_tol(self, abs_tol: S) -> Subject<'a, S, FloatTolerance<S>, R>
fn with_abs_tol(self, abs_tol: S) -> Subject<'a, S, FloatTolerance<S>, R>
Set the absolute tolerance.
source§impl<'a, S, R> FloatAssertion<'a, S, R> for Subject<'a, S, FloatTolerance<S>, R>
impl<'a, S, R> FloatAssertion<'a, S, R> for Subject<'a, S, FloatTolerance<S>, R>
source§fn with_rel_tol(self, rel_tol: S) -> Subject<'a, S, FloatTolerance<S>, R>
fn with_rel_tol(self, rel_tol: S) -> Subject<'a, S, FloatTolerance<S>, R>
Set the relative tolerance.
source§fn with_abs_tol(self, abs_tol: S) -> Subject<'a, S, FloatTolerance<S>, R>
fn with_abs_tol(self, abs_tol: S) -> Subject<'a, S, FloatTolerance<S>, R>
Set the absolute tolerance.
source§fn is_approx_equal_to<B: Borrow<S>>(&self, expected: B) -> R
fn is_approx_equal_to<B: Borrow<S>>(&self, expected: B) -> R
Checks the subject is equal to
expected
with tolerance. Read moresource§impl<'a, S, T, R> IteratorAssertion<'a, S, T, R> for Subject<'a, S, (), R>
impl<'a, S, T, R> IteratorAssertion<'a, S, T, R> for Subject<'a, S, (), R>
source§fn contains<B>(&self, element: B) -> R
fn contains<B>(&self, element: B) -> R
Checks that the subject iterator contains the element
expected
. Read moresource§fn does_not_contain<B>(&self, element: B) -> R
fn does_not_contain<B>(&self, element: B) -> R
Checks that the subject iterator does not contains the element
expected
. Read moresource§fn contains_exactly<EI: Iterator<Item = T> + Clone>(
self,
expected_iter: EI,
) -> R
fn contains_exactly<EI: Iterator<Item = T> + Clone>( self, expected_iter: EI, ) -> R
Checks that the subject exactly contains elements of
expected_iter
. Read moresource§fn contains_exactly_in_order<EI: Iterator<Item = T> + Clone>(
self,
expected_iter: EI,
) -> R
fn contains_exactly_in_order<EI: Iterator<Item = T> + Clone>( self, expected_iter: EI, ) -> R
Checks that the subject exactly contains elements of
expected_iter
in the same order. Read moresource§fn contains_all_of<EI: Iterator<Item = T> + Clone>(self, expected_iter: EI) -> R
fn contains_all_of<EI: Iterator<Item = T> + Clone>(self, expected_iter: EI) -> R
Checks that the subject contains at least all elements of
expected_iter
. Read moresource§fn does_not_contain_any<EI: Iterator<Item = T> + Clone>(
&self,
elements: EI,
) -> R
fn does_not_contain_any<EI: Iterator<Item = T> + Clone>( &self, elements: EI, ) -> R
Checks that the subject does not contains any elements of
elements
. Read moresource§fn contains_all_of_in_order<EI: Iterator<Item = T> + Clone>(
self,
expected_iter: EI,
) -> R
fn contains_all_of_in_order<EI: Iterator<Item = T> + Clone>( self, expected_iter: EI, ) -> R
Checks that the subject contains at least all elements of
expected_iter
in the same order. Read moresource§fn is_not_empty(&self) -> Rwhere
T: Debug,
fn is_not_empty(&self) -> Rwhere
T: Debug,
Checks that the subject is not empty. Read more
source§impl<'a, K, V, ML, R> MapAssertion<'a, K, V, ML, R> for Subject<'a, ML, (), R>
impl<'a, K, V, ML, R> MapAssertion<'a, K, V, ML, R> for Subject<'a, ML, (), R>
source§fn has_length(&self, length: usize) -> R
fn has_length(&self, length: usize) -> R
Checks that the subject has the given length.
source§fn is_not_empty(&self) -> Rwhere
K: Debug,
fn is_not_empty(&self) -> Rwhere
K: Debug,
Checks that the subject is not empty.
source§fn contains_key<BK>(&self, key: BK) -> R
fn contains_key<BK>(&self, key: BK) -> R
Checks that the subject has the given
key
.source§fn does_not_contain_key<BK>(&self, key: BK) -> R
fn does_not_contain_key<BK>(&self, key: BK) -> R
Checks that the subject does not have the given
key
.source§fn contains_entry<BK, BV>(&self, key: BK, value: BV) -> R
fn contains_entry<BK, BV>(&self, key: BK, value: BV) -> R
Checks that the subject has entry with the given
key
and value
.source§fn does_not_contain_entry<BK, BV>(&self, key: BK, value: BV) -> R
fn does_not_contain_entry<BK, BV>(&self, key: BK, value: BV) -> R
Checks that the subject does not contain entry with the given
key
and value
.source§fn contains_at_least<BM, OML>(&self, expected: BM) -> R
fn contains_at_least<BM, OML>(&self, expected: BM) -> R
Checks that the subject contains all entries from
expected
.source§fn does_not_contain_any<BM, OML>(&self, expected: BM) -> R
fn does_not_contain_any<BM, OML>(&self, expected: BM) -> R
Checks that the subject does not contain any entries from
expected
.source§fn contains_exactly<BM, OML>(&self, expected: BM) -> R
fn contains_exactly<BM, OML>(&self, expected: BM) -> R
Checks that the subject contains only entries from
expected
.source§impl<T, R> OptionAssertion<T, R> for Subject<'_, Option<T>, (), R>where
AssertionResult: AssertionStrategy<R>,
impl<T, R> OptionAssertion<T, R> for Subject<'_, Option<T>, (), R>where
AssertionResult: AssertionStrategy<R>,
source§fn has_value<B>(&self, expected: B) -> R
fn has_value<B>(&self, expected: B) -> R
Checks the subject is
Option::Some(expected)
.source§impl<'a, K, V, ML, R> OrderedMapAssertion<'a, K, V, ML, R> for Subject<'a, ML, (), R>
impl<'a, K, V, ML, R> OrderedMapAssertion<'a, K, V, ML, R> for Subject<'a, ML, (), R>
source§fn contains_exactly_in_order<BM, OML>(&self, expected: BM) -> R
fn contains_exactly_in_order<BM, OML>(&self, expected: BM) -> R
Checks that the subject exactly contains
expected
in the same order.source§impl<'a, T, R, ST> OrderedSetAssertion<'a, ST, T, R> for Subject<'a, ST, (), R>
impl<'a, T, R, ST> OrderedSetAssertion<'a, ST, T, R> for Subject<'a, ST, (), R>
source§fn contains_all_of_in_order<OSA, OS>(&self, expected: OSA) -> R
fn contains_all_of_in_order<OSA, OS>(&self, expected: OSA) -> R
Checks that the subject contains at least all elements of
expected
in the same order. Read moresource§fn contains_exactly_in_order<OSA, OS>(&self, expected: OSA) -> R
fn contains_exactly_in_order<OSA, OS>(&self, expected: OSA) -> R
Checks that the subject exactly contains elements of
expected
in the same order. Read moresource§impl<R, OK: Debug, ERR: Debug> ResultAssertion<R, OK, ERR> for Subject<'_, Result<OK, ERR>, (), R>where
AssertionResult: AssertionStrategy<R>,
impl<R, OK: Debug, ERR: Debug> ResultAssertion<R, OK, ERR> for Subject<'_, Result<OK, ERR>, (), R>where
AssertionResult: AssertionStrategy<R>,
source§fn is_ok(&self) -> R
fn is_ok(&self) -> R
Checks that the subject is
Result::Ok(_)
.source§fn is_err(&self) -> R
fn is_err(&self) -> R
Checks that the subject is
Result::Err(_)
.source§fn has_ok<B: Borrow<OK>>(&self, expected: B) -> Rwhere
OK: PartialEq,
fn has_ok<B: Borrow<OK>>(&self, expected: B) -> Rwhere
OK: PartialEq,
Checks that the subject is
Result::Ok(expected)
.source§fn has_err<B: Borrow<ERR>>(&self, expected: B) -> Rwhere
ERR: PartialEq,
fn has_err<B: Borrow<ERR>>(&self, expected: B) -> Rwhere
ERR: PartialEq,
Checks that the subject is
Result::Err(expected)
.source§impl<'a, T, R, ST> SetAssertion<'a, ST, T, R> for Subject<'a, ST, (), R>
impl<'a, T, R, ST> SetAssertion<'a, ST, T, R> for Subject<'a, ST, (), R>
source§impl<R> StringAssertion<R> for Subject<'_, &str, (), R>where
AssertionResult: AssertionStrategy<R>,
impl<R> StringAssertion<R> for Subject<'_, &str, (), R>where
AssertionResult: AssertionStrategy<R>,
source§fn is_same_string_to<E: Into<String>>(&self, expected: E) -> R
fn is_same_string_to<E: Into<String>>(&self, expected: E) -> R
Checks that the subject is same string to
expected
.source§fn contains<E: Into<String>>(&self, expected: E) -> R
fn contains<E: Into<String>>(&self, expected: E) -> R
Checks that the subject contains
expected
.source§fn does_not_contain<E: Into<String>>(&self, value: E) -> R
fn does_not_contain<E: Into<String>>(&self, value: E) -> R
Checks that the subject does not contains
value
.source§fn starts_with<E: Into<String>>(&self, expected: E) -> R
fn starts_with<E: Into<String>>(&self, expected: E) -> R
Checks that the subject starts with
expected
.source§impl<R> StringAssertion<R> for Subject<'_, String, (), R>where
AssertionResult: AssertionStrategy<R>,
impl<R> StringAssertion<R> for Subject<'_, String, (), R>where
AssertionResult: AssertionStrategy<R>,
source§fn is_same_string_to<E: Into<String>>(&self, expected: E) -> R
fn is_same_string_to<E: Into<String>>(&self, expected: E) -> R
Checks that the subject is same string to
expected
.source§fn contains<E: Into<String>>(&self, expected: E) -> R
fn contains<E: Into<String>>(&self, expected: E) -> R
Checks that the subject contains
expected
.source§fn does_not_contain<E: Into<String>>(&self, value: E) -> R
fn does_not_contain<E: Into<String>>(&self, value: E) -> R
Checks that the subject does not contains
value
.source§fn starts_with<E: Into<String>>(&self, expected: E) -> R
fn starts_with<E: Into<String>>(&self, expected: E) -> R
Checks that the subject starts with
expected
.source§impl<'a, T, R> VecAssertion<'a, Vec<T>, T, R> for Subject<'a, Vec<T>, (), R>where
AssertionResult: AssertionStrategy<R>,
impl<'a, T, R> VecAssertion<'a, Vec<T>, T, R> for Subject<'a, Vec<T>, (), R>where
AssertionResult: AssertionStrategy<R>,
source§fn contains<B>(&self, element: B) -> R
fn contains<B>(&self, element: B) -> R
Checks that the subject contains the element
expected
. Read moresource§fn does_not_contain<B>(&self, element: B) -> R
fn does_not_contain<B>(&self, element: B) -> R
Checks that the subject does not contains the
element
. Read moresource§fn contains_exactly<B: Borrow<Vec<T>>>(self, expected_iter: B) -> R
fn contains_exactly<B: Borrow<Vec<T>>>(self, expected_iter: B) -> R
Checks that the subject exactly contains elements of
expected_vec
. Read moresource§fn contains_exactly_in_order<B: Borrow<Vec<T>>>(self, expected_iter: B) -> R
fn contains_exactly_in_order<B: Borrow<Vec<T>>>(self, expected_iter: B) -> R
Checks that the subject exactly contains
expected_vec
in the same order. Read moresource§fn does_not_contain_any<B: Borrow<Vec<T>>>(&self, elements: B) -> R
fn does_not_contain_any<B: Borrow<Vec<T>>>(&self, elements: B) -> R
Checks that the subject does not contain any element of
elements
. Read moresource§fn is_not_empty(&self) -> Rwhere
T: Debug,
fn is_not_empty(&self) -> Rwhere
T: Debug,
Checks that the subject is not empty. Read more
source§fn has_length(&self, length: usize) -> R
fn has_length(&self, length: usize) -> R
Checks that the subject is the given length. Read more
Auto Trait Implementations§
impl<'a, Sub, Opt, Ret> Freeze for Subject<'a, Sub, Opt, Ret>
impl<'a, Sub, Opt, Ret> RefUnwindSafe for Subject<'a, Sub, Opt, Ret>
impl<'a, Sub, Opt, Ret> Send for Subject<'a, Sub, Opt, Ret>
impl<'a, Sub, Opt, Ret> Sync for Subject<'a, Sub, Opt, Ret>
impl<'a, Sub, Opt, Ret> Unpin for Subject<'a, Sub, Opt, Ret>
impl<'a, Sub, Opt, Ret> UnwindSafe for Subject<'a, Sub, Opt, Ret>
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