Skip to main content

Table

Struct Table 

Source
pub struct Table<M> { /* private fields */ }
Expand description

Table description of a Resource’s list view declaring columns and how they map to queries.

Implementations§

Source§

impl<M> Table<M>

Source

pub async fn render<'a>( &self, cx: &'a Cx, page: TablePage<M>, ) -> Result<BoxView<'a>>
where M: Model + Send + Sync + 'static,

Render the table for the given loaded page.

§Errors

A misdeclared table (Table::declaration_errors) fails with its errors rather than render.

Source

pub async fn render_with_state<'a>( &self, cx: &'a Cx, page: TablePage<M>, state: &TableState, path: &str, ) -> Result<BoxView<'a>>
where M: Model + Send + Sync + 'static,

Render with explicit list state and path, normalizing the state before rendering links.

Source§

impl<M> Table<M>

Source

pub fn new(cols: impl IntoColumns<M>) -> Self
where M: Model + IntoExpr<M>,

Declare a table of cols.

Each row is keyed by its record’s primary key, which the row’s action URLs carry.

Source

pub fn column(self, column: impl Column<M> + 'static) -> Self

Append column after the declared ones.

Source

pub fn filters(self, filters: impl IntoFilters<M>) -> Self
where M: Model,

Declare filters.

Source

pub fn group_by<T>(self, lens: Lens<M, T>) -> Self
where M: Model + Send + Sync + 'static, T: FormScalar + Send + Sync + 'static,

Offer grouping the page’s rows by the field lens reads, under the field’s name.

Source

pub fn paginate(self, per_page: usize) -> Self

Set the page size.

Source

pub fn declaration_errors(&self) -> Vec<DeclarationErrorKind>

What is wrong with this declaration.

Source

pub fn page_size(&self) -> usize

The page size.

Render no search toolbar in the table.

Source

pub fn hide_filter_bar(self) -> Self

Render no filter bar in the table.

Enable keystroke-live search via the table_search shard.

Trait Implementations§

Source§

impl<M> Clone for Table<M>

A copy sharing every column, filter and projection.

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<M> Debug for Table<M>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<M> !RefUnwindSafe for Table<M>

§

impl<M> !UnwindSafe for Table<M>

§

impl<M> Freeze for Table<M>
where Vec<Arc<dyn Column<M>>>: Freeze, Vec<Arc<dyn Filter<M>>>: Freeze, Option<GroupDef<M>>: Freeze, fn(&M) -> String: Freeze, Option<Arc<dyn Fn(&M) -> RowActions + Sync + Send>>: Freeze, Vec<TableAction<M>>: Freeze, PhantomData<M>: Freeze,

§

impl<M> Send for Table<M>
where Vec<Arc<dyn Column<M>>>: Send, Vec<Arc<dyn Filter<M>>>: Send, Option<GroupDef<M>>: Send, fn(&M) -> String: Send, Option<Arc<dyn Fn(&M) -> RowActions + Sync + Send>>: Send, Vec<TableAction<M>>: Send, PhantomData<M>: Send,

§

impl<M> Sync for Table<M>
where Vec<Arc<dyn Column<M>>>: Sync, Vec<Arc<dyn Filter<M>>>: Sync, Option<GroupDef<M>>: Sync, fn(&M) -> String: Sync, Option<Arc<dyn Fn(&M) -> RowActions + Sync + Send>>: Sync, Vec<TableAction<M>>: Sync, PhantomData<M>: Sync,

§

impl<M> Unpin for Table<M>
where Vec<Arc<dyn Column<M>>>: Unpin, Vec<Arc<dyn Filter<M>>>: Unpin, Option<GroupDef<M>>: Unpin, fn(&M) -> String: Unpin, Option<Arc<dyn Fn(&M) -> RowActions + Sync + Send>>: Unpin, Vec<TableAction<M>>: Unpin, PhantomData<M>: Unpin,

§

impl<M> UnsafeUnpin for Table<M>
where Vec<Arc<dyn Column<M>>>: UnsafeUnpin, Vec<Arc<dyn Filter<M>>>: UnsafeUnpin, Option<GroupDef<M>>: UnsafeUnpin, fn(&M) -> String: UnsafeUnpin, Option<Arc<dyn Fn(&M) -> RowActions + Sync + Send>>: UnsafeUnpin, Vec<TableAction<M>>: UnsafeUnpin, PhantomData<M>: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneAny for T
where T: Any + Clone,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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