pub struct StreamingTable<K> { /* private fields */ }Expand description
Keyed rows rendered incrementally; see the module docs.
K is the stable row key (a job id, a path, a sequence number). Cells are
Values shown through each Column’s formatter; the frame (title,
caption, box, edges, expand, border style) is set with the same builders
as TableData.
Implementations§
Source§impl<K> StreamingTable<K>
impl<K> StreamingTable<K>
Sourcepub fn title(self, title: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
A centered title above the table (console markup, as the core
Table::title).
Sourcepub fn caption(self, caption: impl Into<String>) -> Self
pub fn caption(self, caption: impl Into<String>) -> Self
A centered caption below the table (console markup).
Sourcepub fn box_set(self, box_set: Box) -> Self
pub fn box_set(self, box_set: Box) -> Self
The box-drawing set (default HEAVY_HEAD, as the core table).
Sourcepub fn without_box(self) -> Self
pub fn without_box(self) -> Self
Draw no borders and no column dividers.
Sourcepub fn border_style(self, style: Style) -> Self
pub fn border_style(self, style: Style) -> Self
Style the box border.
Source§impl<K: Eq + Hash + Clone> StreamingTable<K>
impl<K: Eq + Hash + Clone> StreamingTable<K>
Sourcepub fn new(columns: impl IntoIterator<Item = Column>) -> Self
pub fn new(columns: impl IntoIterator<Item = Column>) -> Self
An empty table under columns.
Sourcepub fn set_window(&mut self, window: Window)
pub fn set_window(&mut self, window: Window)
Change the window.
Sourcepub fn capacity(self, rows: usize) -> Self
pub fn capacity(self, rows: usize) -> Self
Keep at most rows rows: inserting beyond that evicts the oldest
(first inserted). Evicted rows count as earlier rows in the indicator.
Sourcepub fn set_sort(&mut self, keys: impl IntoIterator<Item = SortKey>)
pub fn set_sort(&mut self, keys: impl IntoIterator<Item = SortKey>)
Show rows sorted by keys (stable over insertion order, empty cells
last), with header indicators; an empty list restores insertion order.
Sorting reorders cached rows without re-rendering them.
Sourcepub fn sort_by(self, keys: impl IntoIterator<Item = SortKey>) -> Self
pub fn sort_by(self, keys: impl IntoIterator<Item = SortKey>) -> Self
Builder form of set_sort.
Sourcepub fn upsert(&mut self, key: K, row: impl IntoIterator<Item = Value>) -> bool
pub fn upsert(&mut self, key: K, row: impl IntoIterator<Item = Value>) -> bool
Insert a row, or replace the row under key in place (it keeps its
position). Returns true when the key is new. Missing cells are
Null; extra cells are dropped. Writing identical values is not a
change and does not re-render the row.
Sourcepub fn update_cell(
&mut self,
key: &K,
column: usize,
value: impl Into<Value>,
) -> bool
pub fn update_cell( &mut self, key: &K, column: usize, value: impl Into<Value>, ) -> bool
Set one cell of the row under key. Returns false when there is no
such row or column.
Sourcepub fn remove(&mut self, key: &K) -> Option<Vec<Value>>
pub fn remove(&mut self, key: &K) -> Option<Vec<Value>>
Remove the row under key, returning its cells.
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Whether a row is stored under key.
Sourcepub fn rows(&self) -> impl Iterator<Item = (&K, &[Value])> + '_
pub fn rows(&self) -> impl Iterator<Item = (&K, &[Value])> + '_
Stored rows in insertion order.
Sourcepub fn stats(&self) -> RenderStats
pub fn stats(&self) -> RenderStats
Render-cache counters since creation (or reset_stats).
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Zero the counters.
Sourcepub fn invalidate(&self)
pub fn invalidate(&self)
Drop every cached row so the next frame renders from scratch. Needed only when rendering to a console with a different theme, since cached lines keep the styles they were rendered with.
Trait Implementations§
Source§impl<K: Eq + Hash + Clone> AccessibleText for StreamingTable<K>
impl<K: Eq + Hash + Clone> AccessibleText for StreamingTable<K>
Source§fn accessible_text(&self, width: usize) -> String
fn accessible_text(&self, width: usize) -> String
width where layout matters.Source§impl<K> Debug for StreamingTable<K>
impl<K> Debug for StreamingTable<K>
Source§impl<K: Eq + Hash + Clone> Renderable for StreamingTable<K>
impl<K: Eq + Hash + Clone> Renderable for StreamingTable<K>
fn rich_render( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>
Source§fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
(minimum, maximum) cell width this renderable wants. The default
assumes the renderable fills the available width (e.g. Panel, Table);
Text overrides it with its content width so the top-level print path can
shrink to fit. Port of __rich_measure__ / Measurement.get.Source§fn fit_to_measurement(&self) -> bool
fn fit_to_measurement(&self) -> bool
Console::print shrinks this renderable to its
measured width. Upstream renders every top-level renderable at the full
console width, so the default is false; an extension may opt in.