Skip to main content

ImageColumn

Struct ImageColumn 

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

A column of a String field holding an uploaded image’s path, rendered as a thumbnail.

tablo_core::ImageColumn::new(tablo_core::lens!(Product.image)).circular();

A rooted path, such as an upload’s, shows as a 40px square thumbnail; an empty value shows the table’s dash, and any other value its text. An absolute http(s) URL shows as an image only once remote allows it.

Implementations§

Source§

impl<M, T> ImageColumn<M, T>
where M: Model,

Source

pub fn new(lens: Lens<M, T>) -> ImageColumn<M, T>
where T: Field<Inner = String>,

Bind the column to the String or Option<String> field lens reads.

Source

pub fn size(self, pixels: u16) -> ImageColumn<M, T>

Show the thumbnail pixels wide and tall.

Source

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

Crop the thumbnail to a circle, for an avatar.

Source

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

Also show an absolute http(s) URL as an image. Every browser that renders the table then loads it from that host as the page opens, so whoever can write the field learns who views the list, and when: allow it for a field only trusted users write.

Source

pub fn label(self, label: impl Into<Text>) -> ImageColumn<M, T>

Replace the label the field’s name gives it.

Source

pub fn width(self, width: ColumnWidth) -> ImageColumn<M, T>

Declare this column’s width.

Source

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

Let each reader hide this column from their list; it starts shown.

Source

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

Let each reader show this column in their list; it starts hidden.

Trait Implementations§

Source§

impl<M, T> Clone for ImageColumn<M, T>

Source§

fn clone(&self) -> ImageColumn<M, T>

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> Column<M> for ImageColumn<M, T>
where M: Model + Send + Sync + 'static, T: FormScalar + Send + Sync + 'static,

Source§

fn name(&self) -> &str

The column’s identifier, distinct within its table.
Source§

fn label(&self) -> Text

The header text.
Source§

fn column_width(&self) -> ColumnWidth

The width the column claims.
Source§

fn toggle(&self) -> ColumnToggle

Whether each reader may hide or show the column in their list, and how it starts. A detail page shows every column.
Source§

fn reads(&self) -> Option<Reads<M>>

The fields of the row text, cell, entry, search_expr and order_by read, or None when the column does not say. Read more
Source§

fn text(&self, _cx: &Cx, row: &M) -> String

The row’s value as plain text.
Source§

fn cell<'a>(&self, cx: &'a Cx, row: &M) -> Pin<Box<dyn View + 'a>>

The row’s table cell.
Source§

fn entry<'a>(&self, cx: &'a Cx, row: &M) -> Pin<Box<dyn View + 'a>>

The record’s entry on a detail page: the label over the cell.
Source§

fn alignment(&self) -> Alignment

Where the header and the cells align their content.
Source§

fn search_expr(&self, _term: &str) -> Option<Expr<bool>>

The predicate a search for term adds, or None when the column does not join the table’s search. A column that joins it answers Some for every non-empty, trimmed term.
Source§

fn order_by(&self, _descending: bool) -> Option<OrderByExpr>

The ordering a sort on this column applies, or None when the header does not link to a sort on it. A sortable column answers Some either way.
Source§

fn includes(&self) -> Includes<M>

The relations text, cell and entry read.
Source§

impl<M, T> Debug for ImageColumn<M, T>

Source§

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

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

impl<M, T> IntoColumns<M> for ImageColumn<M, T>
where ImageColumn<M, T>: Column<M> + 'static,

Source§

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

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

impl<M, T> IntoDetail<M> for ImageColumn<M, T>
where ImageColumn<M, T>: Column<M> + 'static,

Auto Trait Implementations§

§

impl<M, T> Freeze for ImageColumn<M, T>

§

impl<M, T> RefUnwindSafe for ImageColumn<M, T>

§

impl<M, T> Send for ImageColumn<M, T>
where M: Send, T: Send,

§

impl<M, T> Sync for ImageColumn<M, T>
where M: Sync, T: Sync,

§

impl<M, T> Unpin for ImageColumn<M, T>
where M: Unpin, T: Unpin,

§

impl<M, T> UnsafeUnpin for ImageColumn<M, T>

§

impl<M, T> UnwindSafe for ImageColumn<M, T>
where M: UnwindSafe, T: 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