Skip to main content

PlaceItem

Struct PlaceItem 

Source
#[non_exhaustive]
pub struct PlaceItem {
Show 17 fields pub id: String, pub name: String, pub path: Option<PathBuf>, pub icon: Option<String>, pub icon_tip: Option<String>, pub badge_icon: Option<PlaceBadgeIcon>, pub image: Option<PlaceImage>, pub detail: Option<String>, pub badge: Option<String>, pub badge_tone: Option<Tone>, pub line: Option<String>, pub toggle: Option<PlaceToggle>, pub children: Vec<PlaceItem>, pub open_at_first: bool, pub open: Option<bool>, pub dimmed: bool, pub segments: Vec<PlaceSegment>,
}
Expand description

One place of a PlaceSection: a folder, a volume, or an application’s own (a card, an account of a service). Made with PlaceItem::new or PlaceItem::folder and its builders.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§id: String

Its id, unique in its section: what a panel says was chosen.

§name: String

Its name, shown and said.

§path: Option<PathBuf>

The folder it opens, if it is one: the picker lists only those.

§icon: Option<String>

An icon of the icon registry (phosphor:sd-card), before its name: what kind of place it is.

§icon_tip: Option<String>

The icon’s tooltip, said in the item’s description (Network node).

§badge_icon: Option<PlaceBadgeIcon>

A second, smaller icon on the corner of PlaceItem::icon: the place’s state (a struck cloud for an offline node), its tooltip said in the item’s description (PlaceItem::badge_icon).

§image: Option<PlaceImage>

An image in the icon’s place (a detected camera’s photo), drawn at the icon’s size; the icon stands in while it loads or if it fails (PlaceItem::image).

§detail: Option<String>

A line about it, in its tip (a card’s free space); its path when none.

§badge: Option<String>

A short mark after its name (a count, “new”), said with it.

§badge_tone: Option<Tone>

The badge’s tone (a warning ▲ on an account to reconnect); plain small text when none.

§line: Option<String>

A line shown under its name, always visible (a path, a card’s free space, “needs reconnecting”): why in a word, on the item itself. Said as the item’s description.

§toggle: Option<PlaceToggle>

A toggle of the application’s at the item’s end (a pin): PlacesOutput::toggled says it was clicked.

§children: Vec<PlaceItem>

The items nested under it (a folder’s subfolders, a keyword’s narrower ones), shown indented under it while it is open: a panel then draws its section as a tree (PlaceItem::children).

§open_at_first: bool

Whether it is open the first time it is shown, when it has children (no by default).

§open: Option<bool>

Whether it is open, when the application keeps the state: the panel follows it (PlacesOutput::expanded says the user asked to change it). Kept in egui’s memory when none.

§dimmed: bool

Drawn muted (a folder of an offline volume): its name, line, badge and icon in the muted text role, said to be unavailable. It stays choosable, its detail still in its tip.

§segments: Vec<PlaceSegment>

Its name as a compacted chain (a / b / c, folders with one child each drawn on one row): each segment its own click target, underlined under the pointer (PlaceItem::segments). None: its name, drawn whole.

Implementations§

Source§

impl PlaceItem

Source

pub fn new(id: impl Into<String>, name: impl Into<String>) -> Self

An item that is no folder: the application acts on it.

Source

pub fn folder(name: impl Into<String>, path: impl Into<PathBuf>) -> Self

A folder, its id its path.

Source

pub fn path(self, path: impl Into<PathBuf>) -> Self

Source

pub fn icon(self, icon: impl Into<String>) -> Self

Source

pub fn icon_tip(self, tip: impl Into<String>) -> Self

The icon’s tooltip (see PlaceItem::icon_tip): what kind of place it is, in words.

Source

pub fn badge_icon(self, icon: impl Into<String>, tip: impl Into<String>) -> Self

A state badge on the corner of the kind icon: an icon of the icon registry (phosphor:cloud-slash) and its tooltip (Offline), the tooltip shown when the pointer is on the badge and said in the item’s description. The kind icon stays what the item is; the badge says how it is. Without a kind icon the badge takes its place.

Need (state): a place shown by its kind with its state on it (a node glyph with an offline mark).

Source

pub fn image(self, image: impl Into<ImageSource<'static>>) -> Self

An image in the icon’s place: a texture the application loaded (egui::load::SizedTexture), or a URI egui’s image loaders read (file://, bytes://, https://). It fills the icon’s square, cropped to its middle and rounded as the theme rounds widgets; the item’s icon is drawn while it loads or if it fails. The item is still said by its name.

Need (image): a place shown by its picture (a camera’s photo) in a places list.

Source

pub fn detail(self, detail: impl Into<String>) -> Self

Source

pub fn badge(self, badge: impl Into<String>) -> Self

Source

pub fn badge_tone(self, tone: Tone) -> Self

The badge’s tone (see PlaceItem::badge_tone).

Source

pub fn line(self, line: impl Into<String>) -> Self

A line under its name, always shown (see PlaceItem::line).

Source

pub fn toggle(self, toggle: PlaceToggle) -> Self

A toggle at its end (see PlaceToggle).

Source

pub fn children(self, children: impl IntoIterator<Item = PlaceItem>) -> Self

Items nested under it, after those it has: a branch of a tree (volume, folder, subfolders; Animals, Dog). A panel indents them by depth under a disclosure toggle named after the item (“Show or hide Animals”); Right opens it and Left folds it while the item has the keyboard, and Up and Down go through the rows shown. Each item is said at its level, a branch as expanded or not.

Need (data): a tree of places in a side panel (folders and their subfolders, nested keywords).

Source

pub fn open_at_first(self, open: bool) -> Self

Whether a branch is open the first time it is shown; its state is then kept in egui’s memory (see PlaceItem::open).

Source

pub fn open(self, open: bool) -> Self

A branch open or not as the application keeps it: the user’s clicks and arrows come back in PlacesOutput::expanded.

Source

pub fn dimmed(self, dimmed: bool) -> Self

Drawn muted and said to be unavailable (see PlaceItem::dimmed): an offline volume’s folders, still choosable.

Need (state): a place shown out of reach but still choosable (a folder of an offline volume).

Source

pub fn segments(self, segments: impl IntoIterator<Item = PlaceSegment>) -> Self

Its name drawn as a compacted chain, a / b / c (egui-pop draws the separator, SEGMENT_SEPARATOR): each segment underlined under the pointer, its own click target and its own node for assistive technology, named by the chain up to it (a / b) or its PlaceSegment::name. A click on a segment is reported in PlacesOutput::segment, not as the item chosen: the application decides what it does. The row keeps its selection, hover highlight, keyboard (Enter chooses the item) and tip, and is still said by PlaceItem::name (give it the whole chain).

Need (data): a tree row of compacted folders (a / b / c) whose each folder is clickable.

Source

pub fn said(&self) -> String

What a screen reader says of it: its name, then its badge.

Trait Implementations§

Source§

impl Clone for PlaceItem

Source§

fn clone(&self) -> PlaceItem

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PlaceItem

Source§

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

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

impl PartialEq for PlaceItem

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for PlaceItem

Source§

impl StructuralPartialEq for PlaceItem

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

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

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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.

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
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

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

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

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
§

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,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,