pub struct Hooks<C> {
pub before_all: Option<for<'a> fn(&'a C) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'a>>>,
pub after_all: Option<for<'a> fn(&'a C) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'a>>>,
pub before_each: Option<for<'a> fn(&'a C) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'a>>>,
pub after_each: Option<for<'a> fn(&'a C) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'a>>>,
pub _phantom: PhantomData<fn(&C)>,
}Expand description
Container for lifecycle hooks with concrete context type.
All hooks are optional. Hooks are executed at specific points in the test lifecycle:
before_all: After context starts, before any tests runafter_all: After all tests complete, before context stops (best-effort)before_each: Before each individual testafter_each: After each individual test (always runs, even if test fails) Container for lifecycle hooks with concrete context type.
All hooks are optional. Hooks are executed at specific points in the test lifecycle:
before_all: After context starts, before any tests runafter_all: After all tests complete, before context stops (best-effort)before_each: Before each individual testafter_each: After each individual test (always runs, even if test fails)
Fields§
§before_all: Option<for<'a> fn(&'a C) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'a>>>§after_all: Option<for<'a> fn(&'a C) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'a>>>§before_each: Option<for<'a> fn(&'a C) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'a>>>§after_each: Option<for<'a> fn(&'a C) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send>>> + Send + 'a>>>§_phantom: PhantomData<fn(&C)>Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Hooks<C>
impl<C> RefUnwindSafe for Hooks<C>
impl<C> Send for Hooks<C>
impl<C> Sync for Hooks<C>
impl<C> Unpin for Hooks<C>
impl<C> UnsafeUnpin for Hooks<C>
impl<C> UnwindSafe for Hooks<C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more