#[non_exhaustive]pub struct Presentation {
pub title: Option<String>,
pub description: Option<String>,
pub icon: Option<Icon>,
pub tint: Option<Tint>,
}Expand description
Presentation hints for one field rule.
#[non_exhaustive]: this is the type that grows every time a frontend needs
a new hint, so it is built from Presentation::default and the chainable
setters below rather than a struct literal. Reading the fields is unchanged.
use fig_schema::{Icon, Presentation, Tint};
let p = Presentation::default()
.title("Audience")
.description("Who may read this")
.icon(Icon::Globe)
.tint(Tint::Positive);
assert_eq!(p.title.as_deref(), Some("Audience"));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.title: Option<String>A human field label.
description: Option<String>Help text / section subtitle.
icon: Option<Icon>A semantic icon.
tint: Option<Tint>A semantic tint.
Implementations§
Source§impl Presentation
impl Presentation
Sourcepub fn title_opt(self, title: Option<impl Into<String>>) -> Self
pub fn title_opt(self, title: Option<impl Into<String>>) -> Self
Set the label from an optional one — for a caller reading a config where
the title may be absent. None leaves it unset.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Set the help text.
Sourcepub fn description_opt(self, description: Option<impl Into<String>>) -> Self
pub fn description_opt(self, description: Option<impl Into<String>>) -> Self
Set the help text from an optional one. None leaves it unset.
Trait Implementations§
Source§impl Clone for Presentation
impl Clone for Presentation
Source§fn clone(&self) -> Presentation
fn clone(&self) -> Presentation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Presentation
impl Debug for Presentation
Source§impl Default for Presentation
impl Default for Presentation
Source§fn default() -> Presentation
fn default() -> Presentation
Returns the “default value” for a type. Read more
impl Eq for Presentation
Source§impl PartialEq for Presentation
impl PartialEq for Presentation
impl StructuralPartialEq for Presentation
Auto Trait Implementations§
impl Freeze for Presentation
impl RefUnwindSafe for Presentation
impl Send for Presentation
impl Sync for Presentation
impl Unpin for Presentation
impl UnsafeUnpin for Presentation
impl UnwindSafe for Presentation
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