Skip to main content

ProjectedResultExpectations

Trait ProjectedResultExpectations 

Source
pub trait ProjectedResultExpectations<'e, T, E>
where T: Debug + 'e, E: Debug + 'e,
{ // Required methods fn to_be_ok_and( self, ) -> ProjectedExpectationsBuilder<'e, Self, Result<T, E>, T> where Self: Sized + ExpectationBuilder<'e, Value = Result<T, E>>; fn to_be_err_and( self, ) -> ProjectedExpectationsBuilder<'e, Self, Result<T, E>, E> where Self: Sized + ExpectationBuilder<'e, Value = Result<T, E>>; }

Required Methods§

Source

fn to_be_ok_and(self) -> ProjectedExpectationsBuilder<'e, Self, Result<T, E>, T>
where Self: Sized + ExpectationBuilder<'e, Value = Result<T, E>>,

Expect the Result to be Ok and then chain into further expectations


let result: Result<i32, &str> = Ok(42);
expect(result).to_be_ok_and().to_equal(42);

asserts that the Result is Ok and the chained expectations hold for the Ok value

Source

fn to_be_err_and( self, ) -> ProjectedExpectationsBuilder<'e, Self, Result<T, E>, E>
where Self: Sized + ExpectationBuilder<'e, Value = Result<T, E>>,

Expect the Result to be Err and then chain into further expectations


let result: Result<i32, &str> = Err("Error message");
expect(result).to_be_err_and().to_equal("Error message");

asserts that the Result is Err and the chained expectations hold for the Err value

Implementors§

Source§

impl<'e, T, E, B> ProjectedResultExpectations<'e, T, E> for B
where T: Debug + 'e, E: Debug + 'e, B: ExpectationBuilder<'e, Value = Result<T, E>>,