Trait Writer

Source
pub trait Writer<World> {
    type Cli: Args;

    // Required method
    fn handle_event(
        &mut self,
        ev: Result<Event<Cucumber<World>>>,
        cli: &Self::Cli,
    ) -> impl Future<Output = ()>;
}
Expand description

Writer of Cucumber events to some output.

As Runner produces events in a happened-before order (see its order guarantees), Writers are required to be Normalized.

As Cucumber::run() returns Writer, it can hold some state inside for inspection after execution. See Summarize and Cucumber::run_and_exit() for examples.

Required Associated Types§

Source

type Cli: Args

CLI options of this Writer. In case no options should be introduced, just use cli::Empty.

All CLI options from Parser, Runner and Writer will be merged together, so overlapping arguments will cause a runtime panic.

Required Methods§

Source

fn handle_event( &mut self, ev: Result<Event<Cucumber<World>>>, cli: &Self::Cli, ) -> impl Future<Output = ()>

Handles the given Cucumber event.

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<W, L, R> Writer<W> for Tee<L, R>
where W: World, L: Writer<W>, R: Writer<W>,

Source§

type Cli = Compose<<L as Writer<W>>::Cli, <R as Writer<W>>::Cli>

Source§

impl<W, L, R, F> Writer<W> for Or<L, R, F>
where W: World, L: Writer<W>, R: Writer<W>, F: FnMut(&Result<Event<Cucumber<W>>>, &Compose<L::Cli, R::Cli>) -> bool,

Source§

type Cli = Compose<<L as Writer<W>>::Cli, <R as Writer<W>>::Cli>

Source§

impl<W, Out> Writer<W> for Basic<Out>
where W: World + Debug, Out: Write,

Source§

impl<W, Out> Writer<W> for JUnit<W, Out>
where W: World + Debug, Out: Write,

Available on crate feature output-junit only.
Source§

impl<W, Wr> Writer<W> for Summarize<Wr>
where W: World, Wr: Arbitrary<W, String> + Summarizable, Wr::Cli: Colored,

Source§

type Cli = <Wr as Writer<W>>::Cli

Source§

impl<W, Wr, F> Writer<W> for FailOnSkipped<Wr, F>
where W: World, F: Fn(&Feature, Option<&Rule>, &Scenario) -> bool, Wr: Writer<W>,

Source§

type Cli = <Wr as Writer<W>>::Cli

Source§

impl<W, Wr, F> Writer<W> for Repeat<W, Wr, F>
where W: World, Wr: Writer<W> + NonTransforming, F: Fn(&Result<Event<Cucumber<W>>>) -> bool,

Source§

type Cli = <Wr as Writer<W>>::Cli

Source§

impl<W: World + Debug, Out: Write> Writer<W> for Json<Out>

Available on crate feature output-json only.
Source§

impl<W: World + Debug, Out: Write> Writer<W> for Libtest<W, Out>

Available on crate feature libtest only.
Source§

impl<W: World, Wr: Writer<W> + ?Sized> Writer<W> for Arbitrary<Wr>

Source§

type Cli = <Wr as Writer<W>>::Cli

Source§

impl<W: World, Wr: Writer<W> + ?Sized> Writer<W> for Stats<Wr>

Source§

type Cli = <Wr as Writer<W>>::Cli

Source§

impl<W: World, Wr: Writer<W> + ?Sized> Writer<W> for AssertNormalized<Wr>

Source§

type Cli = <Wr as Writer<W>>::Cli

Source§

impl<World, Wr: Writer<World>> Writer<World> for Normalize<World, Wr>

Source§

type Cli = <Wr as Writer<World>>::Cli