Struct Libtest

Source
pub struct Libtest<W, Out: Write = Stdout> { /* private fields */ }
Available on crate feature libtest only.
Expand description

libtest compatible Writer.

Currently used only to support --format=json option.

§Ordering

This Writer isn’t Normalized by itself, so should be wrapped into a writer::Normalize, otherwise will produce output Events in a broken order.

Ideally, we shouldn’t wrap this into a writer::Normalize and leave this to tools, parsing JSON output. Unfortunately, not all tools can do that (ex. IntelliJ Rust), so it’s still recommended to wrap this into writer::Normalize even if it can mess up timing reports.

Implementations§

Source§

impl<W: Debug + World> Libtest<W, Stdout>

Source

pub fn stdout() -> Normalize<W, Self>

Creates a new Normalized Libtest Writer outputting into the io::Stdout.

Source

pub fn or<AnotherWriter: Writer<W>>( writer: AnotherWriter, ) -> Or<W, AnotherWriter>

Creates a new Writer which uses a Normalized Libtest in case Cli::format is set to Json, or provided the writer otherwise.

Source

pub fn or_basic() -> OrBasic<W>

Creates a new Writer which uses a Normalized Libtest in case Cli::format is set to Json, or a Normalized writer::Basic otherwise.

Source§

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

Source

pub fn new(output: Out) -> Normalize<W, Self>

Creates a new Normalized Libtest Writer outputting into the provided output.

Theoretically, normalization should be done by the tool that’s consuming the output og this Writer. But lack of clear specification of the libtest’s JSON output leads to some tools struggling to interpret it. So, we recommend using a Normalized Libtest::new() rather than a non-Normalized Libtest::raw().

Source

pub const fn raw(output: Out) -> Self

Creates a new non-Normalized Libtest Writer outputting into the provided output.

Theoretically, normalization should be done by the tool that’s consuming the output og this Writer. But lack of clear specification of the libtest’s JSON output leads to some tools struggling to interpret it. So, we recommend using a Normalized Libtest::new() rather than a non-Normalized Libtest::raw().

Trait Implementations§

Source§

impl<W, Val, Out> Arbitrary<W, Val> for Libtest<W, Out>
where W: World + Debug, Val: AsRef<str>, Out: Write,

Source§

async fn write(&mut self, val: Val)

Writes val to the Writer’s output.
Source§

impl<World, Out: Clone + Write> Clone for Libtest<World, Out>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<W, O> Stats<W> for Libtest<W, O>
where O: Write, Self: Writer<W>,

Source§

fn passed_steps(&self) -> usize

Returns number of Passed Steps.
Source§

fn skipped_steps(&self) -> usize

Returns number of Skipped Steps.
Source§

fn failed_steps(&self) -> usize

Returns number of Failed Steps.
Source§

fn retried_steps(&self) -> usize

Returns number of retried Steps.
Source§

fn parsing_errors(&self) -> usize

Returns number of parsing errors.
Source§

fn hook_errors(&self) -> usize

Returns number of failed Scenario hooks.
Source§

fn execution_has_failed(&self) -> bool

Indicates whether there were failures/errors during execution.
Source§

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

Source§

type Cli = Cli

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

async fn handle_event( &mut self, event: Result<Event<Cucumber<W>>>, cli: &Self::Cli, )

Handles the given Cucumber event.
Source§

impl<W, O: Write> NonTransforming for Libtest<W, O>

Auto Trait Implementations§

§

impl<W, Out> Freeze for Libtest<W, Out>
where Out: Freeze,

§

impl<W, Out = Stdout> !RefUnwindSafe for Libtest<W, Out>

§

impl<W, Out = Stdout> !Send for Libtest<W, Out>

§

impl<W, Out = Stdout> !Sync for Libtest<W, Out>

§

impl<W, Out> Unpin for Libtest<W, Out>
where Out: Unpin,

§

impl<W, Out = Stdout> !UnwindSafe for Libtest<W, Out>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Ext for T

Source§

fn assert_normalized(self) -> AssertNormalized<T>

Asserts this Writer being Normalized. Read more
Source§

fn normalized<W>(self) -> Normalize<W, T>

Wraps this Writer into a Normalized version. Read more
Source§

fn summarized(self) -> Summarize<T>

Wraps this Writer to print a summary at the end of an output. Read more
Source§

fn fail_on_skipped(self) -> FailOnSkipped<T>

Wraps this Writer to fail on Skipped Steps if their Scenario isn’t marked with @allow.skipped tag. Read more
Source§

fn fail_on_skipped_with<F>(self, f: F) -> FailOnSkipped<T, F>
where F: Fn(&Feature, Option<&Rule>, &Scenario) -> bool,

Wraps this Writer to fail on Skipped Steps if the given with predicate returns true. Read more
Source§

fn repeat_skipped<W>(self) -> Repeat<W, T>

Wraps this Writer to re-output Skipped Steps at the end of an output.
Source§

fn repeat_failed<W>(self) -> Repeat<W, T>

Wraps this Writer to re-output Failed Steps or Parser errors at the end of an output.
Source§

fn repeat_if<W, F>(self, filter: F) -> Repeat<W, T, F>
where F: Fn(&Result<Event<Cucumber<W>>, Error>) -> bool,

Wraps this Writer to re-output filtered events at the end of an output.
Source§

fn tee<W, Wr>(self, other: Wr) -> Tee<T, Wr>
where Wr: Writer<W>,

Attaches the provided other Writer to the current one for passing events to both of them simultaneously.
Source§

fn discard_arbitrary_writes(self) -> Arbitrary<T>

Wraps this Writer into a discard::Arbitrary one, providing a no-op ArbitraryWriter implementation. Read more
Source§

fn discard_stats_writes(self) -> Stats<T>

Wraps this Writer into a discard::Stats one, providing a no-op StatsWriter implementation returning only 0. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Summarizable for T
where T: NonTransforming,