Skip to main content

AssertBorrowedOptionValue

Trait AssertBorrowedOptionValue 

Source
pub trait AssertBorrowedOptionValue<'a, T, R> {
    // Required method
    fn some(self) -> Spec<'a, &'a T, R>;
}
Expand description

Assert the value of a borrowed option by mapping the subject.

If the option is none, the assertion fails.

§Examples

use asserting::prelude::*;

let subject: Option<Vec<usize>> = Some(vec![1, 2, 3]);
assert_that!(&subject).some().contains_exactly(&[1, 2, 3]);

let subject: Option<&str> = Some("ullamco cupiditat diam hendrerit");
assert_that!(&subject).some().is_not_empty();

Required Methods§

Source

fn some(self) -> Spec<'a, &'a T, R>

Maps the subject to the option’s value if it has some. Otherwise, this assertion fails.

§Examples
use asserting::prelude::*;

let subject: Option<Vec<usize>> = Some(vec![1, 2, 3]);
assert_that!(&subject).some().contains_exactly(&[1, 2, 3]);

let subject: Option<&str> = Some("ullamco cupiditat diam hendrerit");
assert_that!(&subject).some().is_not_empty();

Implementors§

Source§

impl<'a, T, R> AssertBorrowedOptionValue<'a, T, R> for Spec<'a, &'a Option<T>, R>
where R: FailingStrategy,