Skip to main content

Showing

Enum Showing 

Source
#[non_exhaustive]
pub enum Showing { All, One, AtMostOne, }
Expand description

How many of a region’s children are visible at once.

One sentence covering three shapes: this region holds several children and shows some of them, and the reader can change which. A tab group, a carousel and a disclosure all need it, and without it a renderer has two moves: hardcode a widget name, or draw every child. That is what puts per-widget code in renderers.

§What is here and what is not

The kind, and only the kind. Which child is currently up is the current answer, and a layer that defers every address does not hold the current answer either — the split Selector already makes, where this crate says what kind of chooser a thing is and the router says which option is picked. So a holder of regions carries the index and the per-child label beside this.

§What a renderer does with it

Derives its chrome, once, for every widget rather than per name:

  • Children carrying labels get a strip of the labels, the current one marked.
  • Children carrying none get previous, position, next.
  • AtMostOne over one child gets a summary line that opens.

The name on Region::Widget survives as app vocabulary, for a renderer that wants to do something special with one, which is what it should have been from the start.

Degradation runs the way it already did: a renderer ignoring this draws every child, which is more content rather than less.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

All

Every child, in order. What every region did before this existed.

§

One

Exactly one. A carousel, a tab group.

§

AtMostOne

One, or none. A disclosure, which is closed until it is opened.

Implementations§

Source§

impl Showing

Source

pub const fn selective(self) -> bool

Whether the reader can change which child is up.

The question every renderer’s region arm asks before deriving any chrome, and a method rather than a matches! at each renderer for Region::name’s reason: three renderers writing the same comparison is how they come to disagree about a member added later.

Source

pub const fn dismissible(self) -> bool

Whether showing nothing is a legal state.

True only for AtMostOne. A renderer needs this to know whether its control closes as well as moves: a carousel’s row moves between frames and never reaches empty, and a disclosure’s summary line is the same control wearing its closed state.

Trait Implementations§

Source§

impl Clone for Showing

Source§

fn clone(&self) -> Showing

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 Copy for Showing

Source§

impl Debug for Showing

Source§

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

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

impl Default for Showing

Source§

fn default() -> Showing

Returns the “default value” for a type. Read more
Source§

impl Eq for Showing

Source§

impl Hash for Showing

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Showing

Source§

fn eq(&self, other: &Showing) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Showing

Auto Trait Implementations§

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