pub struct TableWidget<'a> {
pub rows: &'a [&'a [&'a str]],
pub headers: Option<&'a [&'a str]>,
pub selected: Option<(usize, usize)>,
pub separators: bool,
pub cell_padding: u8,
pub align: TextAlign,
}Expand description
2D Table Data Grid Widget with cell selection and 2D navigation.
Fields§
§rows: &'a [&'a [&'a str]]§headers: Option<&'a [&'a str]>§selected: Option<(usize, usize)>§separators: bool§cell_padding: u8§align: TextAlignImplementations§
Source§impl<'a> TableWidget<'a>
impl<'a> TableWidget<'a>
pub const fn new(rows: &'a [&'a [&'a str]]) -> Self
pub const fn with_headers(self, headers: &'a [&'a str]) -> Self
pub const fn with_selection(self, row: usize, col: usize) -> Self
pub const fn with_separators(self, separators: bool) -> Self
pub const fn with_align(self, align: TextAlign) -> Self
Sourcepub fn move_cursor(&mut self, d_row: i32, d_col: i32)
pub fn move_cursor(&mut self, d_row: i32, d_col: i32)
Moves the active 2D selection cursor by (d_row, d_col).
pub fn render<D, C>( &self, ctx: &mut RenderCtx<'_, D, C>, rect: Rect, style: WidgetStyle, state: VisualState, ) -> Result<(), D::Error>
Trait Implementations§
Source§impl<'a> Clone for TableWidget<'a>
impl<'a> Clone for TableWidget<'a>
Source§fn clone(&self) -> TableWidget<'a>
fn clone(&self) -> TableWidget<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for TableWidget<'a>
Source§impl<'a> Debug for TableWidget<'a>
impl<'a> Debug for TableWidget<'a>
Source§impl<'a> PartialEq for TableWidget<'a>
impl<'a> PartialEq for TableWidget<'a>
impl<'a> StructuralPartialEq for TableWidget<'a>
Source§impl<'a> Widget for TableWidget<'a>
impl<'a> Widget for TableWidget<'a>
fn render_widget_bounds(&self, _bounds: Rect, _style: &Style)
fn get_property(&self, key: PropertyKey) -> Option<PropertyValue<'_>>
fn set_property<'p>( &mut self, key: PropertyKey, val: PropertyValue<'p>, ) -> Result<(), PropertyError>
fn handle_widget_event( &mut self, _event: &UiEvent, _ctx: &mut EventContext, ) -> EventPolicy
Auto Trait Implementations§
impl<'a> Freeze for TableWidget<'a>
impl<'a> RefUnwindSafe for TableWidget<'a>
impl<'a> Send for TableWidget<'a>
impl<'a> Sync for TableWidget<'a>
impl<'a> Unpin for TableWidget<'a>
impl<'a> UnsafeUnpin for TableWidget<'a>
impl<'a> UnwindSafe for TableWidget<'a>
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.