pub struct ComputedColumn<M> { /* private fields */ }Expand description
A display-only column rendering any text from the row, with no query predicate.
tablo_core::ComputedColumn::new("Author", |p: &Post| p.author.get().name.clone())
.include(Post::fields().author());It maps to no column, so it neither searches nor sorts:
ⓘ
tablo_core::ComputedColumn::new("Name", |u: &User| u.name.clone()).sortable();Implementations§
Source§impl<M> ComputedColumn<M>where
M: Model,
impl<M> ComputedColumn<M>where
M: Model,
Sourcepub fn new(
label: impl Into<String>,
project: impl Fn(&M) -> String + Send + Sync + 'static,
) -> Self
pub fn new( label: impl Into<String>, project: impl Fn(&M) -> String + Send + Sync + 'static, ) -> Self
Declare a column headed label rendering project(row).
Sourcepub fn include<T>(self, relation: impl Into<Include<M, T>>) -> Self
pub fn include<T>(self, relation: impl Into<Include<M, T>>) -> Self
Declare a relation the projection reads, so the table loads it.
Sourcepub fn width(self, width: ColumnWidth) -> Self
pub fn width(self, width: ColumnWidth) -> Self
Declare this column’s width.
Trait Implementations§
Source§impl<M> Clone for ComputedColumn<M>
impl<M> Clone for ComputedColumn<M>
Source§impl<M> Column<M> for ComputedColumn<M>
impl<M> Column<M> for ComputedColumn<M>
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 search_expr(&self, _term: &str) -> Option<Expr<bool>>
fn search_expr(&self, _term: &str) -> Option<Expr<bool>>
The predicate a search for
term adds.Source§fn is_sortable(&self) -> bool
fn is_sortable(&self) -> bool
Whether the header links to a sort on this column.
Source§impl<M> Debug for ComputedColumn<M>
impl<M> Debug for ComputedColumn<M>
impl<M> IntoColumns<M> for ComputedColumn<M>
Auto Trait Implementations§
impl<M> !RefUnwindSafe for ComputedColumn<M>
impl<M> !UnwindSafe for ComputedColumn<M>
impl<M> Freeze for ComputedColumn<M>
impl<M> Send for ComputedColumn<M>
impl<M> Sync for ComputedColumn<M>
impl<M> Unpin for ComputedColumn<M>
impl<M> UnsafeUnpin for ComputedColumn<M>
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