Skip to main content

ItBuilder

Struct ItBuilder 

Source
pub struct ItBuilder { /* private fields */ }
Expand description

Builder returned by Context::it. Supports chaining decorators and registers the test node when dropped.

// Simple (drops immediately, registered at semicolon):
ctx.it("simple", || { assert!(true); });

// With decorators:
ctx.it("complex", || { /* ... */ })
    .labels(&["integration"])
    .retries(3)
    .timeout(5000);

Implementations§

Source§

impl ItBuilder

Source

pub fn labels(self, labels: &[&str]) -> Self

Add labels for filtering via RSSPEC_LABEL_FILTER. Labels accumulate across multiple calls.

Source

pub fn retries(self, n: u32) -> Self

Retry the test up to n additional times on failure.

Source

pub fn timeout(self, ms: u64) -> Self

Fail the test if it exceeds ms milliseconds.

Note: The timeout is checked after the closure returns — the closure cannot be forcibly aborted mid-execution. If your test blocks forever (e.g. an infinite loop or deadlock), the timeout will not fire.

Source

pub fn must_pass_repeatedly(self, n: u32) -> Self

Require the test to pass n consecutive times.

Trait Implementations§

Source§

impl Drop for ItBuilder

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.