pub struct Snap(_);
Expand description
String with concurrent access. Allows mutation without &mut reference to itself. It makes passing it to different parts of tests easier when performance is not important. Useful for accumulating output from a system under test and later using it with assert_matches_inline_snapshot.
let snap = k9::Snap::new();
let closure_captured_snap_by_ref = || {
snap.push("a");
};
closure_captured_snap_by_ref();
closure_captured_snap_by_ref();
closure_captured_snap_by_ref();
k9::snapshot!(snap.to_string(), "aaa");
Implementations
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Snap
impl Send for Snap
impl Sync for Snap
impl Unpin for Snap
impl UnwindSafe for Snap
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more