pub struct Frame { /* private fields */ }Expand description
Logical output from a Component::render call: a vector of Lines plus a Cursor position.
A Frame is a pure data structure with no terminal formatting. The Renderer consumes frames, diffs them against the previous render, and emits only the changed ANSI sequences.
§Construction
use tui::{Frame, Line};
use tui::Cursor;
let frame = Frame::new(vec![
Line::new("Hello, world!"),
Line::new("Press q to quit"),
]);
// Optionally place a visible cursor
let frame = frame.with_cursor(Cursor::visible(0, 5));§Methods
lines()— Borrow the rendered lines.cursor()— The current cursor state.with_cursor(cursor)— Replace the cursor (builder pattern, movesself).clamp_cursor()— Clamp the cursor row to the last line index, preventing out-of-bounds positions.into_lines()— Consume the frame and return the lines.into_parts()— Consume and return(Vec<Line>, Cursor).
§See also
Implementations§
Source§impl Frame
impl Frame
pub fn new(lines: Vec<Line>) -> Self
pub fn lines(&self) -> &[Line]
pub fn cursor(&self) -> Cursor
Sourcepub fn with_cursor(self, cursor: Cursor) -> Self
pub fn with_cursor(self, cursor: Cursor) -> Self
Replace the cursor without cloning lines.
pub fn into_lines(self) -> Vec<Line>
pub fn into_parts(self) -> (Vec<Line>, Cursor)
pub fn clamp_cursor(self) -> Self
Trait Implementations§
impl Eq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
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
Mutably borrows from an owned value. Read more
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
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more