pub struct TestingContext {
pub events: Vec<CapturedEvent>,
pub handler_invocations: Vec<HandlerInvocation>,
pub mutations: HashMap<String, Vec<MutationRecord>>,
/* private fields */
}Expand description
Audit log that captures events, handler invocations, and mutations during test execution.
Only allocated when vm.in_test_context is true. Zero cost in production.
Fields§
§events: Vec<CapturedEvent>§handler_invocations: Vec<HandlerInvocation>§mutations: HashMap<String, Vec<MutationRecord>>Keyed by “namespace::primitive_name”
Implementations§
Source§impl TestingContext
impl TestingContext
pub fn new() -> Self
pub fn clear(&mut self)
pub fn record_event( &mut self, namespace: String, event: String, variant: String, depth: u8, columns: Columns, )
pub fn record_handler_invocation( &mut self, namespace: String, handler: String, event: String, variant: String, duration_ns: u64, outcome: String, message: String, )
pub fn record_mutation( &mut self, primitive_key: String, op: String, old: Columns, new: Columns, )
pub fn record_insert(&mut self, key: String, new: Columns)
pub fn record_delete(&mut self, key: String, old: Columns)
pub fn record_update(&mut self, key: String, old: Columns, new: Columns)
Trait Implementations§
Source§impl Clone for TestingContext
impl Clone for TestingContext
Source§fn clone(&self) -> TestingContext
fn clone(&self) -> TestingContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TestingContext
impl RefUnwindSafe for TestingContext
impl Send for TestingContext
impl Sync for TestingContext
impl Unpin for TestingContext
impl UnsafeUnpin for TestingContext
impl UnwindSafe for TestingContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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