pub struct TextColumn<M, T> { /* private fields */ }Expand description
A column of one field, rendered as text and bound through a Lens for sorting and search.
tablo_core::TextColumn::new(tablo_core::lens!(User.name))
.searchable()
.sortable();
tablo_core::TextColumn::new(tablo_core::lens!(User.age)).sortable();
tablo_core::TextColumn::new(tablo_core::lens!(Post.status))
.format(|status| PostStatus::label_of(status));The cell is the value’s form spelling (FormScalar::to_form) unless
format says otherwise. Only a string field is
searchable:
ⓘ
tablo_core::TextColumn::new(tablo_core::lens!(User.age)).searchable();Implementations§
Source§impl<M, T> TextColumn<M, T>where
M: Model,
impl<M, T> TextColumn<M, T>where
M: Model,
Sourcepub fn new(lens: Lens<M, T>) -> Self
pub fn new(lens: Lens<M, T>) -> Self
Bind a column to the field lens reads, which must be one field of the model.
Sourcepub fn format(
self,
format: impl Fn(&T) -> String + Send + Sync + 'static,
) -> Self
pub fn format( self, format: impl Fn(&T) -> String + Send + Sync + 'static, ) -> Self
Render the field’s value through format.
Sourcepub fn width(self, width: ColumnWidth) -> Self
pub fn width(self, width: ColumnWidth) -> Self
Declare this column’s width.
Trait Implementations§
Source§impl<M, T> Clone for TextColumn<M, T>
impl<M, T> Clone for TextColumn<M, T>
Source§impl<M, T> Column<M> for TextColumn<M, T>
impl<M, T> Column<M> for TextColumn<M, T>
Source§fn column_width(&self) -> ColumnWidth
fn column_width(&self) -> ColumnWidth
The width the column claims.
Source§fn is_searchable(&self) -> bool
fn is_searchable(&self) -> bool
Whether the column joins the table’s search.
Source§fn is_sortable(&self) -> bool
fn is_sortable(&self) -> bool
Whether the header links to a sort on this column.
Source§impl<M, T> Debug for TextColumn<M, T>
impl<M, T> Debug for TextColumn<M, T>
impl<M, T> IntoColumns<M> for TextColumn<M, T>
Auto Trait Implementations§
impl<M, T> !RefUnwindSafe for TextColumn<M, T>
impl<M, T> !UnwindSafe for TextColumn<M, T>
impl<M, T> Freeze for TextColumn<M, T>
impl<M, T> Send for TextColumn<M, T>
impl<M, T> Sync for TextColumn<M, T>
impl<M, T> Unpin for TextColumn<M, T>
impl<M, T> UnsafeUnpin for TextColumn<M, T>
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