Skip to main content

Detail

Struct Detail 

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

The declaration of a detail page: Columns, the same ones a Table lists, arranged in Section, Group, Grid and Tabs blocks.

use tablo_core::{BooleanColumn, Detail, RelationColumn, Section, TextColumn, lens, relation};

Detail::new(Section::new("Post").columns((
    TextColumn::new(lens!(Post.title)),
    BooleanColumn::new(lens!(Post.featured)),
    RelationColumn::unscoped(relation!(Post.author), |a: &Author| a.name.clone()),
)));

The detail page loads the relations its columns declare (Column::includes) and renders each column’s entry for the record.

Implementations§

Source§

impl<M> Detail<M>

Source

pub fn new(children: impl IntoDetail<M>) -> Self

Declare a detail page of children: columns and blocks of them.

Source

pub fn empty() -> Self

A detail page showing nothing, which turns the page off.

Source

pub fn is_empty(&self) -> bool

Whether the declaration shows nothing.

Source

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

Append column after the declared columns and blocks.

Source

pub async fn load(&self, cx: &Cx, query: Query<List<M>>) -> Result<Vec<M>>
where M: Model + Send + Sync + 'static,

Load the records query names as a page rendering this declaration reads them: with every relation the columns declare, once each, and the related records the columns’ sources show the user checked, so render shows only those. Pass the resource’s scope, as in detail.load(cx, scoped_query::<R>(cx)?).

§Errors

A source’s scope refusing the request, or a database failure.

Source

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

What is wrong with this declaration: each column whose path binds no single field.

Source

pub fn render<'a>(&self, cx: &'a Cx, record: &M) -> BoxView<'a>

Renders record’s entries in their blocks: each column’s entry, read-only.

The panel’s detail page renders its view this way. A page of the app’s own renders one for a record it loaded through load: a scoped relation column over a record loaded otherwise shows no related record.

Trait Implementations§

Source§

impl<M> Debug for Detail<M>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<M> Default for Detail<M>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<M> IntoDetail<M> for Detail<M>

Auto Trait Implementations§

§

impl<M> !RefUnwindSafe for Detail<M>

§

impl<M> !UnwindSafe for Detail<M>

§

impl<M> Freeze for Detail<M>
where Vec<Node<M>>: Freeze,

§

impl<M> Send for Detail<M>
where Vec<Node<M>>: Send,

§

impl<M> Sync for Detail<M>
where Vec<Node<M>>: Sync,

§

impl<M> Unpin for Detail<M>
where Vec<Node<M>>: Unpin,

§

impl<M> UnsafeUnpin for Detail<M>
where Vec<Node<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> ErasedDestructor for T
where T: 'static,

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, 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