pub struct State<Id> { /* private fields */ }sidebar only.Expand description
The navigation, the active item and how the sidebar is shown.
Implementations§
Source§impl<Id: Copy + PartialEq> State<Id>
impl<Id: Copy + PartialEq> State<Id>
Sourcepub fn new(groups: impl IntoIterator<Item = Group<Id>>) -> Self
pub fn new(groups: impl IntoIterator<Item = Group<Id>>) -> Self
An expanded sidebar with every group open and nothing active.
Sourcepub fn with_active(self, id: Id) -> Self
pub fn with_active(self, id: Id) -> Self
Starts with id active, opening its parent when it is a child.
pub fn groups(&self) -> &[Group<Id>]
pub fn active(&self) -> Option<Id>
pub fn highlighted(&self) -> Option<Row<Id>>
Sourcepub fn is_rail(&self) -> bool
pub fn is_rail(&self) -> bool
Whether the sidebar is set to collapse to a rail on wide windows.
Sourcepub fn is_compact(&self) -> bool
pub fn is_compact(&self) -> bool
Whether the sidebar is drawn as a rail right now: collapsed on a wide window. The drawer always shows labels.
pub fn is_narrow(&self) -> bool
pub fn is_drawer_open(&self) -> bool
pub fn is_focused(&self) -> bool
Sourcepub fn shows_highlight(&self) -> bool
pub fn shows_highlight(&self) -> bool
Whether the highlighted row gets a ring: while the sidebar has keys and the keyboard moved the highlight last.
Sourcepub fn has_keys(&self) -> bool
pub fn has_keys(&self) -> bool
Whether the sidebar resolves its keymap: while focused or while the drawer is open.
pub fn is_group_open(&self, group: usize) -> bool
pub fn is_expanded(&self, id: Id) -> bool
pub fn item(&self, id: Id) -> Option<&Item<Id>>
Sourcepub fn is_active_branch(&self, item: &Item<Id>) -> bool
pub fn is_active_branch(&self, item: &Item<Id>) -> bool
Whether an item or one of its children is the active one, so a closed parent still shows where the page is.
Sourcepub fn rows(&self) -> Vec<Row<Id>>
pub fn rows(&self) -> Vec<Row<Id>>
The rows the keyboard moves through, in order: headings of collapsible groups and the enabled items that are showing.
Sourcepub fn update(&mut self, event: Event<Id>) -> Option<Output<Id>>
pub fn update(&mut self, event: Event<Id>) -> Option<Output<Id>>
Applies an event and returns the activated item, if any.
Sourcepub fn shortcut(
&self,
keymap: &Keymap<Action>,
key: &Event,
) -> Option<Event<Id>>
pub fn shortcut( &self, keymap: &Keymap<Action>, key: &Event, ) -> Option<Event<Id>>
Turns a key press from keys::subscription into an event for the
app-wide action, Action::ToggleRail. The sidebar resolves every
other action itself while it has focus.
Trait Implementations§
impl<Id: PartialEq> StructuralPartialEq for State<Id>
Auto Trait Implementations§
impl<Id> Freeze for State<Id>
impl<Id> RefUnwindSafe for State<Id>where
Vec<Group<Id>>: RefUnwindSafe,
Option<Id>: RefUnwindSafe,
Option<Row<Id>>: RefUnwindSafe,
Vec<Id>: RefUnwindSafe,
impl<Id> Send for State<Id>
impl<Id> Sync for State<Id>
impl<Id> Unpin for State<Id>
impl<Id> UnsafeUnpin for State<Id>where
Vec<Group<Id>>: UnsafeUnpin,
Option<Id>: UnsafeUnpin,
Option<Row<Id>>: UnsafeUnpin,
Vec<Id>: UnsafeUnpin,
impl<Id> UnwindSafe for State<Id>where
Vec<Group<Id>>: UnwindSafe,
Option<Id>: UnwindSafe,
Option<Row<Id>>: UnwindSafe,
Vec<Id>: UnwindSafe,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.