pub struct FrameRecord {
pub snapshot: String,
pub lines: Vec<String>,
}Expand description
Snapshot of a single rendered frame, captured by
TestBackend::record_frames.
Stores the styled snapshot string (via Buffer::snapshot_format) plus a
per-row trimmed text view for ergonomic substring assertions. Both are
produced from the same buffer and are guaranteed to refer to the same
frame.
Cheap to clone; useful for replaying a failing test by inspecting intermediate frames.
Fields§
§snapshot: StringStyled snapshot of the buffer at this frame, in the stable
Buffer::snapshot_format vocabulary.
lines: Vec<String>Plain-text view of each buffer row, trailing spaces trimmed.
Mirrors TestBackend::line for every row.
Implementations§
Source§impl FrameRecord
impl FrameRecord
Sourcepub fn to_string_trimmed(&self) -> String
pub fn to_string_trimmed(&self) -> String
Return the frame as a multi-line string (rows joined with \n,
trailing empty rows preserved). Mirrors TestBackend::to_string_trimmed
on the originating buffer.
Sourcepub fn line(&self, y: u32) -> &str
pub fn line(&self, y: u32) -> &str
Return the trimmed text of row y from this frame, or empty if y
is past the buffer height.
Sourcepub fn assert_contains(&self, expected: &str)
pub fn assert_contains(&self, expected: &str)
Assert any row in this frame contains expected. Panics with a
row-by-row dump on failure.
Trait Implementations§
Source§impl Clone for FrameRecord
impl Clone for FrameRecord
Source§fn clone(&self) -> FrameRecord
fn clone(&self) -> FrameRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FrameRecord
impl Debug for FrameRecord
impl Eq for FrameRecord
Source§impl PartialEq for FrameRecord
impl PartialEq for FrameRecord
Source§fn eq(&self, other: &FrameRecord) -> bool
fn eq(&self, other: &FrameRecord) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for FrameRecord
Auto Trait Implementations§
impl Freeze for FrameRecord
impl RefUnwindSafe for FrameRecord
impl Send for FrameRecord
impl Sync for FrameRecord
impl Unpin for FrameRecord
impl UnsafeUnpin for FrameRecord
impl UnwindSafe for FrameRecord
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.