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>
impl<K> ContentList<K>
Sourcepub fn new<P: Piece>(build: impl Fn() -> P + 'static) -> ContentList<K>
pub fn new<P: Piece>(build: impl Fn() -> P + 'static) -> ContentList<K>
The pane, from its builder.
Sourcepub fn width(self, width: f64) -> ContentList<K>
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.
Sourcepub fn only_for(self, pred: impl Fn(&K) -> bool + 'static) -> ContentList<K>
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.
Sourcepub fn detail_visible(self, visible: impl Binding<bool>) -> ContentList<K>
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.
Sourcepub fn detail_for<T: Clone + 'static>(
self,
selected: impl Binding<Option<T>>,
) -> ContentList<K>
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)Sourcepub fn detail_title<M>(self, t: impl IntoText<M>) -> ContentList<K>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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