Skip to main content

FieldColumn

Struct FieldColumn 

Source
pub struct FieldColumn<M, T, P = T> { /* private fields */ }
Expand description

One field of a model, as the PanelModel derive’s columns() hands it over: Product::columns().qty.

Placed as it is, in a Table or on a Detail page, it is the column the derive picks for the field’s type there, with the field’s #[columns(..)] keys applied: the column the model’s default table or detail page shows. A kind method, such as text, date or toggle, is that column type’s own builder over the field instead, labelled by the field’s #[columns(label = "..")]; each compiles only for a field type its column reads.

use tablo_core::Table;

let columns = Product::columns();
Table::new((
    // The derive's pick: a sortable, searchable text.
    columns.name,
    // A text column of the derive's, reshaped.
    columns.qty.text().numeric(0).sortable(),
    // A switch saving the record as it flips, in place of the derive's yes or no.
    columns.active.toggle(),
));

lens hands over the field’s Lens for a filter, a tab or a field access rule; lens! builds one for a path the derive does not reach, such as an embedded value’s own field.

Implementations§

Source§

impl<M, T, P> FieldColumn<M, T, P>

Source

pub fn lens(&self) -> Lens<M, T, P>

The field’s lens: its query path paired with its reader.

Source§

impl<M, T> FieldColumn<M, T>
where M: Model, T: FormScalar + Send + Sync + 'static,

Source

pub fn text(self) -> TextColumn<M, T>

A TextColumn: the value’s text, or an Options enum’s label.

Source

pub fn icon(self) -> IconColumn<M, T>

An IconColumn: an Options enum’s icon in place of its label.

Source

pub fn text_input(self) -> TextInputColumn<M, T>

A TextInputColumn: a text input saving the record as it changes.

Source§

impl<M, T> FieldColumn<M, T>
where M: Model, T: DateValue,

Source

pub fn date(self) -> DateColumn<M, T>

A DateColumn: the value’s calendar day.

Source§

impl<M, T> FieldColumn<M, T>
where M: Model, T: Options + FormScalar + Send + Sync + 'static,

Source

pub fn select(self) -> SelectColumn<M, T>

A SelectColumn: a select over the enum’s options, saving the record as it changes.

Source§

impl<M, T> FieldColumn<M, T>
where M: Model, T: Field<Inner = String>,

Source

pub fn color(self) -> ColorColumn<M, T>

A ColorColumn: a swatch of the CSS color the text holds.

Source

pub fn image(self) -> ImageColumn<M, T>

An ImageColumn: the image the text names.

Source

pub fn rich_text(self) -> RichTextColumn<M, T>

A RichTextColumn: the cleaned HTML the text holds.

Source§

impl<M> FieldColumn<M, bool>
where M: Model,

Source

pub fn boolean(self) -> BooleanColumn<M>

A BooleanColumn: a yes or no.

Source

pub fn toggle(self) -> ToggleColumn<M>

A ToggleColumn: a switch saving the record as it flips.

Source§

impl<M> FieldColumn<M, String>
where M: Model,

Source

pub fn file(self) -> FileColumn<M>

A FileColumn: a link to the upload the text names.

Source§

impl<M, T> FieldColumn<M, T>
where M: Model, T: EmbeddedForm,

Source

pub fn embedded(self) -> EmbeddedColumn<M, T>

An EmbeddedColumn: the embedded value’s leaves.

Source§

impl<M, T> FieldColumn<M, Vec<T>, List<T>>
where M: Model, T: FormScalar,

Source

pub fn list(self) -> ListColumn<M, T>

A ListColumn: a badge per value.

Source§

impl<M, T> FieldColumn<M, Vec<T>, List<T>>
where M: Model, T: FormInput,

Source

pub fn repeater(self) -> RepeaterColumn<M, T>

A RepeaterColumn: the list’s items.

Trait Implementations§

Source§

impl<M, T, P> Clone for FieldColumn<M, T, P>

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, T, P> From<FieldColumn<M, T, P>> for Lens<M, T, P>

Source§

fn from(column: FieldColumn<M, T, P>) -> Self

Converts to this type from the input type.
Source§

impl<M, T, P> IntoColumns<M> for FieldColumn<M, T, P>

The table column the derive picks, or none for a field only a detail page shows.

Source§

fn into_columns(self) -> Vec<Arc<dyn Column<M>>>

The columns, in the order the table lists them.
Source§

impl<M, T, P> IntoDetail<M> for FieldColumn<M, T, P>

The detail page column the derive picks.

Auto Trait Implementations§

§

impl<M, T, P> Freeze for FieldColumn<M, T, P>

§

impl<M, T, P> RefUnwindSafe for FieldColumn<M, T, P>

§

impl<M, T, P> Send for FieldColumn<M, T, P>
where M: Send, P: Send,

§

impl<M, T, P> Sync for FieldColumn<M, T, P>
where M: Sync, P: Sync,

§

impl<M, T, P> Unpin for FieldColumn<M, T, P>
where M: Unpin, P: Unpin,

§

impl<M, T, P> UnsafeUnpin for FieldColumn<M, T, P>

§

impl<M, T, P> UnwindSafe for FieldColumn<M, T, P>
where M: UnwindSafe, P: UnwindSafe,

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
§

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

§

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

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
§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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.

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more