Struct k9::Snap[][src]

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

Push a substring

Push a substring and add a newline \n at the end

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.