[][src]Trait expected::FutureExpectedExt

pub trait FutureExpectedExt: Future + Sized {
    fn expected(self) -> Expected<Self> { ... }
}

An extension trait for Futures that provides an adaptor for tracking that all expectations are satisfied.

Provided methods

Important traits for Expected<Fut>
fn expected(self) -> Expected<Self>

See that all expectations are satisfied until the future is completed.

Example

use expected::{expect, expect_eq};
use expected::FutureExpectedExt as _;

let name = "Alice";
let country = "Wonderland";
let age = 14;

let fut = async {
    expect_eq!(name, "Alice");
    expect!(country.contains("land"));
    // ...
    expect!(age >= 20);
};

let (_, disappoints) = fut.expected().await;

if let Some(disappoints) = disappoints {
    eprintln!("{}", disappoints);
}
Loading content...

Implementors

impl<F: Future> FutureExpectedExt for F[src]

Loading content...