TableRenderContext

Struct TableRenderContext 

Source
pub struct TableRenderContext {
Show 18 fields pub row_count: usize, pub visible_row_indices: Vec<usize>, pub data_rows: Vec<Vec<String>>, pub column_headers: Vec<String>, pub column_widths: Vec<u16>, pub pinned_column_indices: Vec<usize>, pub pinned_count: usize, pub selected_row: usize, pub selected_column: usize, pub row_viewport: Range<usize>, pub selection_mode: SelectionMode, pub sort_state: Option<SortState>, pub show_row_numbers: bool, pub app_mode: AppMode, pub fuzzy_filter_pattern: Option<String>, pub case_insensitive: bool, pub available_width: u16, pub available_height: u16,
}
Expand description

All the data needed to render a table, collected in one place This allows the table renderer to be independent of TUI internals

Fields§

§row_count: usize

Total number of rows in the dataset

§visible_row_indices: Vec<usize>

Row indices to display (the visible viewport)

§data_rows: Vec<Vec<String>>

The actual data to display (already formatted as strings) Outer vec is rows, inner vec is columns

§column_headers: Vec<String>

Column headers in visual order

§column_widths: Vec<u16>

Column widths in visual order (matching column_headers)

§pinned_column_indices: Vec<usize>

Indices of pinned columns (in visual space)

§pinned_count: usize

Number of pinned columns (convenience field)

§selected_row: usize

Currently selected row (absolute index, not viewport-relative)

§selected_column: usize

Currently selected column (visual index)

§row_viewport: Range<usize>

Row viewport range (start..end absolute indices)

§selection_mode: SelectionMode

Selection mode (Cell or Row)

§sort_state: Option<SortState>

Sort state (which column is sorted and how)

§show_row_numbers: bool

Whether to show row numbers

§app_mode: AppMode

Current application mode (for title bar)

§fuzzy_filter_pattern: Option<String>

Fuzzy filter pattern if active

§case_insensitive: bool

Whether filter is case insensitive

§available_width: u16

Available width for the table (excluding borders)

§available_height: u16

Available height for the table (excluding borders)

Implementations§

Source§

impl TableRenderContext

Source

pub fn is_selected_row(&self, viewport_row_index: usize) -> bool

Check if a given row is the currently selected row

Source

pub fn is_selected_column(&self, visual_column_index: usize) -> bool

Check if a given column is the currently selected column

Source

pub fn is_pinned_column(&self, visual_column_index: usize) -> bool

Check if a column is pinned

Source

pub fn get_crosshair(&self) -> (usize, usize)

Get the crosshair position (selected cell)

Source

pub fn is_crosshair_cell( &self, viewport_row_index: usize, visual_column_index: usize, ) -> bool

Check if we’re at a specific cell

Source

pub fn get_sort_indicator(&self, visual_column_index: usize) -> &str

Get sort indicator for a column

Source

pub fn cell_matches_filter(&self, cell_value: &str) -> bool

Check if a cell value matches the fuzzy filter

Trait Implementations§

Source§

impl Clone for TableRenderContext

Source§

fn clone(&self) -> TableRenderContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TableRenderContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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
Source§

impl<T> ErasedDestructor for T
where T: 'static,