pub struct CountColumn<M> { /* private fields */ }Expand description
A column counting the records of a Deferred has_many field, which declares the field’s
include so every page that renders it loads the records.
use tablo_core::{CountColumn, relation};
CountColumn::new(relation!(Post.comments));The header and the column’s name are the field’s name, capitalized, until
label replaces both.
The count is the length of the loaded list: a page loads every related record of every row it
counts, and the related resource’s query and policy do not apply, so the count includes
records its own list hides.
Implementations§
Source§impl<M> CountColumn<M>where
M: Model,
impl<M> CountColumn<M>where
M: Model,
Sourcepub fn new<T>(relation: RelationLens<M, Deferred<Vec<T>>>) -> Selfwhere
T: Model + 'static,
M: 'static,
pub fn new<T>(relation: RelationLens<M, Deferred<Vec<T>>>) -> Selfwhere
T: Model + 'static,
M: 'static,
Declare a column counting the records relation loads.
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
Replace the label the field’s name gives it, and name the column after the label, as a
ComputedColumn is: two columns over one relation need two labels.
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 CountColumn<M>
impl<M> Clone for CountColumn<M>
Source§impl<M> Column<M> for CountColumn<M>
impl<M> Column<M> for CountColumn<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 CountColumn<M>
impl<M> Debug for CountColumn<M>
impl<M> IntoColumns<M> for CountColumn<M>
Source§impl<M> IntoDetail<M> for CountColumn<M>
impl<M> IntoDetail<M> for CountColumn<M>
fn into_detail(self) -> Detail<M>
Auto Trait Implementations§
impl<M> !RefUnwindSafe for CountColumn<M>
impl<M> !UnwindSafe for CountColumn<M>
impl<M> Freeze for CountColumn<M>
impl<M> Send for CountColumn<M>
impl<M> Sync for CountColumn<M>
impl<M> Unpin for CountColumn<M>
impl<M> UnsafeUnpin for CountColumn<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