pub trait OptionAssertions<T> {
// Required methods
fn is_some(self) -> Self;
fn is_none(self) -> Self;
fn to_value_ref(&self) -> AssertThat<&T>;
}Expand description
An extension trait to be used on the output of assert_that with Option argument. All assertions here work for references to Options as well.
Examples:
use kernal::prelude::*;
assert_that!(Some(2 + 3)).is_some().to_value_ref().is_equal_to(&5);
assert_that!(None::<u32>).is_none();Required Methods§
Sourcefn is_some(self) -> Self
fn is_some(self) -> Self
Asserts that the tested option is a Some variant with any value, i.e. that
Option::is_some is true.
Sourcefn is_none(self) -> Self
fn is_none(self) -> Self
Asserts that the tested option is a None variant, i.e. that Option::is_none is true.
Sourcefn to_value_ref(&self) -> AssertThat<&T>
fn to_value_ref(&self) -> AssertThat<&T>
Asserts that the tested option is a Some variant and converts this asserter to one for a
reference to the contained value, so chained assertions can be run on the unwrapped value.
If you are asserting over an owned Option, use OwnedOptionAssertions::to_value to obtain
an asserter over the owned value.
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.