Struct k9::Snap [−][src]
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
impl Snap
[src]
pub fn new() -> Self
[src]
pub fn from<S: Into<String>>(s: S) -> Self
[src]
pub fn push<S: Into<String>>(&self, s: S)
[src]
Push a substring
pub fn pushln<S: Into<String>>(&self, s: S)
[src]
Push a substring and add a newline \n
at the end
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,