#[non_exhaustive]pub enum Icon {
Link,
Enum,
Toggle,
Lock,
Globe,
Clock,
Tag,
Text,
Other(String),
}Expand description
A semantic icon hint. Frontends map to their own symbol set.
#[non_exhaustive]: the set grows as fields do, so a match needs a _
arm. Constructing a variant is unaffected.
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.
Link
Enum
Toggle
Lock
Globe
Clock
Tag
Text
Other(String)
An escape hatch naming a frontend-specific symbol.
Implementations§
Source§impl Icon
impl Icon
Sourcepub fn from_name(name: &str) -> Icon
pub fn from_name(name: &str) -> Icon
The icon a schema document’s icon key names. Never fails: a name that
is not one of the eight known is Icon::Other, because a frontend’s
own symbol name is not a typo — a presenter fails open.
use fig_schema::Icon;
assert_eq!(Icon::from_name("globe"), Icon::Globe);
assert_eq!(Icon::from_name("sparkles"), Icon::Other("sparkles".into()));Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The name Icon::from_name reads this icon back from.
Trait Implementations§
impl Eq for Icon
impl StructuralPartialEq for Icon
Auto Trait Implementations§
impl Freeze for Icon
impl RefUnwindSafe for Icon
impl Send for Icon
impl Sync for Icon
impl Unpin for Icon
impl UnsafeUnpin for Icon
impl UnwindSafe for Icon
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
Mutably borrows from an owned value. Read more