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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more