pub struct SerialPane { /* private fields */ }Expand description
Terminal-emulator-backed pane for serial data.
Wraps a vt100::Parser with a fixed scrollback budget.
Use SerialPane::ingest to feed newly received bytes;
SerialPane::screen exposes the current grid for rendering.
Implementations§
Source§impl SerialPane
impl SerialPane
Sourcepub const DEFAULT_SCROLLBACK_ROWS: usize = 10_000
pub const DEFAULT_SCROLLBACK_ROWS: usize = 10_000
Default scrollback capacity applied by SerialPane::new.
10,000 rows is enough for ~minutes of typical embedded debug
output and keeps peak memory bounded (cell grid at 80 cols
≈ 80 bytes × 10_000 ≈ 800 KiB).
Sourcepub fn with_scrollback(rows: u16, cols: u16, scrollback_rows: usize) -> Self
pub fn with_scrollback(rows: u16, cols: u16, scrollback_rows: usize) -> Self
Build a pane with an explicit scrollback capacity.
Sourcepub fn ingest(&mut self, bytes: &[u8])
pub fn ingest(&mut self, bytes: &[u8])
Feed bytes into the terminal emulator.
Safe to call with any arbitrary byte stream — invalid escape sequences are dropped by vt100.
Sourcepub fn screen(&self) -> &Screen
pub fn screen(&self) -> &Screen
Reference to the current vt100 Screen.
The screen is mutable internally but exposed as & so callers
can only read it; ingestion must go through SerialPane::ingest.
Sourcepub fn resize(&mut self, rows: u16, cols: u16)
pub fn resize(&mut self, rows: u16, cols: u16)
Resize the emulator grid.
vt100 reflows accordingly — lines longer than the new width wrap; scrollback is preserved as-is.
Sourcepub const fn scrollback_rows(&self) -> usize
pub const fn scrollback_rows(&self) -> usize
Scrollback row count configured for this pane.
Sourcepub fn scrollback_offset(&self) -> usize
pub fn scrollback_offset(&self) -> usize
Current scrollback offset from the live tail (0 = live).
A non-zero value means the rendered view is above the live
tail by that many rows; new bytes continue to accumulate in
the buffer but do not scroll the view until the user scrolls
back down via SerialPane::scroll_down /
SerialPane::scroll_to_bottom.
Sourcepub fn is_scrolled(&self) -> bool
pub fn is_scrolled(&self) -> bool
True when the view is above the live tail.
Consumers (e.g. the top-bar renderer) use this as the “should
I show the [SCROLL ↑N] indicator?” predicate.
Sourcepub fn scroll_up(&mut self, lines: usize)
pub fn scroll_up(&mut self, lines: usize)
Scroll up by lines (toward older content).
Clamped to the configured scrollback capacity so extreme input
values (e.g. usize::MAX) do not overflow. vt100 also clamps
internally to the actual amount of scrollback accumulated so
far, so requesting more than exists simply lands at “top of
history”.
Sourcepub fn scroll_down(&mut self, lines: usize)
pub fn scroll_down(&mut self, lines: usize)
Scroll down by lines (toward newer content / the live tail).
Saturates at 0 (live tail); calling with a huge value is
equivalent to SerialPane::scroll_to_bottom.
Sourcepub fn scroll_to_top(&mut self)
pub fn scroll_to_top(&mut self)
Jump to the oldest row retained in the scrollback buffer.
Requests the configured scrollback capacity; vt100 internally clamps to however much history actually exists.
Sourcepub fn scroll_to_bottom(&mut self)
pub fn scroll_to_bottom(&mut self)
Jump back to the live tail (scrollback_offset == 0).
Auto Trait Implementations§
impl Freeze for SerialPane
impl RefUnwindSafe for SerialPane
impl Send for SerialPane
impl Sync for SerialPane
impl Unpin for SerialPane
impl UnsafeUnpin for SerialPane
impl UnwindSafe for SerialPane
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> 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>
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>
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