AssertOption

Trait AssertOption 

Source
pub trait AssertOption {
    // Required methods
    fn is_some(self) -> Self;
    fn is_none(self) -> Self;
}
Expand description

Assert whether a subject of the Option type holds some value or has none.

§Examples

use asserting::prelude::*;

let subject = Some("nisl possim nobis non".to_string());
assert_that!(subject).is_some();

#[derive(Debug)]
struct MyType;

let subject: Option<MyType> = None;
assert_that!(subject).is_none();

Required Methods§

Source

fn is_some(self) -> Self

Verifies that the subject has some value.

§Examples
use asserting::prelude::*;

let subject = Some("nisl possim nobis non".to_string());
assert_that!(subject).is_some();

#[derive(Debug)]
struct MyType;

let subject = Some(MyType);
assert_that!(subject).is_some();
Source

fn is_none(self) -> Self

Verifies that the subject has no value.

§Examples
use asserting::prelude::*;

let subject: Option<String> = None;
assert_that!(subject).is_none();

#[derive(Debug)]
struct MyType;

let subject: Option<MyType> = None;
assert_that!(subject).is_none();

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S, R> AssertOption for Spec<'_, &Option<S>, R>
where S: Debug, R: FailingStrategy,

Source§

impl<S, R> AssertOption for Spec<'_, Option<S>, R>
where S: Debug, R: FailingStrategy,