Skip to main content

ContentList

Struct ContentList 

Source
pub struct ContentList<K = String> { /* private fields */ }
Expand description

The content-list pane of a Mail-shaped nav (docs/navigation.md), declared with Nav::content_list: mailboxes, message list, message. build makes the middle column, built once and resident for the host’s life; its content follows the app’s own signals (the selection scoping it, the row chosen from it), never a rebuild.

Where the toolkit has a native pane (Cap::NavContentList) the list gets its own column (an AppKit contentList split item, a UIKit supplementary column) and otherwise the nav composes it beside (split) or in place of (stacked) each destination. Pair it with detail_visible so compact widths get the list-then-detail push flow, and only_for to give full-width destinations (a settings page) the whole detail area.

Implementations§

Source§

impl<K> ContentList<K>

Source

pub fn new<P: Piece>(build: impl Fn() -> P + 'static) -> ContentList<K>

The pane, from its builder.

Source

pub fn width(self, width: f64) -> ContentList<K>

Preferred width of the pane in points (default day_spec::NAV_LIST_WIDTH). Where the divider is user-draggable this is the initial width, not a limit.

Source

pub fn only_for(self, pred: impl Fn(&K) -> bool + 'static) -> ContentList<K>

Which destinations show the pane (default: all of them). A destination answering false collapses the pane and takes the whole detail area: the settings page beside a mail-shaped app.

Source

pub fn detail_visible(self, visible: impl Binding<bool>) -> ContentList<K>

Whether the detail is showing, two-way (a Signal<bool> or any other binding). Split-family presentations ignore it: the detail pane is always there, showing the app’s empty state until a row is chosen. A stacked presentation (a phone, a collapsed split) uses it as the push gate: the list is the top of the stack until the app writes true (a row was opened), the detail pushes then, and the platform’s back writes false on the way out.

Source

pub fn detail_for<T: Clone + 'static>( self, selected: impl Binding<Option<T>>, ) -> ContentList<K>

The detail shows while selected holds a value: detail_visible for a list whose selection is the detail’s subject. Writing Some opens the detail on a stacked presentation; the platform’s back writes None, which clears the selection.

ⓘ
ContentList::new(item_list).detail_for(scene.selected)
Source

pub fn detail_title<M>(self, t: impl IntoText<M>) -> ContentList<K>

The navigation-bar title of the detail layer the list opens: the editor a phone pushes over the list, the detail column’s bar where the toolkit titles one. Reactive like every title: pass a closure reading your own state to title the page after the item it shows. Unset, the detail layer keeps its destination’s title.

Auto Trait Implementations§

§

impl<K = String> !RefUnwindSafe for ContentList<K>

§

impl<K = String> !Send for ContentList<K>

§

impl<K = String> !Sync for ContentList<K>

§

impl<K = String> !UnwindSafe for ContentList<K>

§

impl<K> Freeze for ContentList<K>

§

impl<K> Unpin for ContentList<K>

§

impl<K> UnsafeUnpin for ContentList<K>

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<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, 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Day API ↩ Guides· daybrite.dev