Skip to main content

SerialPane

Struct SerialPane 

Source
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

Source

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).

Source

pub fn new(rows: u16, cols: u16) -> Self

Build a pane with the default scrollback capacity.

Source

pub fn with_scrollback(rows: u16, cols: u16, scrollback_rows: usize) -> Self

Build a pane with an explicit scrollback capacity.

Source

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.

Source

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.

Source

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.

Source

pub const fn scrollback_rows(&self) -> usize

Scrollback row count configured for this pane.

Source

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.

Source

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.

Source

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”.

Source

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.

Source

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.

Source

pub fn scroll_to_bottom(&mut self)

Jump back to the live tail (scrollback_offset == 0).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more