[−][src]Struct assert4rs::Assert
Implementations
impl<T> Assert<T>
[src]
Entry point for the Assert DSL.
Assert provides a fluent API for assertions. An Assert holds
the actual
value that can be used in assertion statements.
Assert::that(3).is(3);
pub fn that(actual: T) -> Self
[src]
Create an Assert instance for the actual
value.
All assertions start with Assert::that(actual)
.
pub fn map<R>(self, f: impl Fn(T) -> R) -> Assert<R>
[src]
Maps the actual
value using lambda f
.
This method is intended to map the actual value in order to apply further assertions.
Assert::that("3") .map(|v| v.parse::<i32>().unwrap()) .is(3);
impl<T> Assert<Option<T>> where
T: PartialEq + Debug,
[src]
T: PartialEq + Debug,
DSL for Option assertions.
pub fn is_some(self, expected: T) -> Self
[src]
Assert that actual
is equal to Some `expected' value.
pub fn is_none(self) -> Self
[src]
Assert that actual
is equal to None.
pub fn unwrap(self) -> Assert<T>
[src]
impl<T> Assert<Vec<T>> where
T: PartialEq + Debug,
[src]
T: PartialEq + Debug,
pub fn contains(self, expected: T) -> Self
[src]
Assert that the actual vector contains a specific expected
value.
Assert::that(vec![1, 2, 3]).contains(2);
pub fn get(&mut self, index: usize) -> Assert<Option<T>>
[src]
Trait Implementations
impl<T, R> AssertEquals<R> for Assert<T> where
T: PartialEq<R> + Debug,
R: Debug,
[src]
T: PartialEq<R> + Debug,
R: Debug,
Default implementation of AssertEquals.
Auto Trait Implementations
impl<T> RefUnwindSafe for Assert<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Assert<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Assert<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Assert<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Assert<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,