pub struct Presentation {
pub elements: Vec<ElementSpec>,
pub theme: Option<Theme>,
pub messages: BTreeMap<String, LocalizedText>,
}Expand description
How a profile presents itself on the dashboard: its custom elements and theme.
A Profile carries an optional presentation, so a deployment’s
dashboard offers exactly the sensor types its profiles introduce and renders them
the way the profile intends. The dashboard turns these declarations into the catalog
it serves to the page.
Fields§
§elements: Vec<ElementSpec>The custom sensors and node stats this profile contributes.
theme: Option<Theme>An optional theme that tints the dashboard.
messages: BTreeMap<String, LocalizedText>Localized text for the stable codes this profile introduces, keyed by the page’s
message key (a discrete state such as "state.flushing" or an event such as
"event.filter_clog"). The dashboard ships no translation for a code it never knew,
so a profile that emits a custom state or event supplies its wording here.
Implementations§
Source§impl Presentation
impl Presentation
Sourcepub fn with_element(self, element: ElementSpec) -> Self
pub fn with_element(self, element: ElementSpec) -> Self
Sourcepub fn with_theme(self, theme: Theme) -> Self
pub fn with_theme(self, theme: Theme) -> Self
Sourcepub fn with_message(
self,
key: impl Into<String>,
text: impl Into<LocalizedText>,
) -> Self
pub fn with_message( self, key: impl Into<String>, text: impl Into<LocalizedText>, ) -> Self
Supplies localized text for a stable code this profile introduces.
Use this for a custom discrete state or event the dashboard ships no wording for, so the page renders it as words rather than the raw code.
§Arguments
key- the page message key, such as"state.flushing"or"event.filter_clog".text- the text, one string for every locale or a per-locale map.
§Returns
The presentation, for chaining.
Trait Implementations§
Source§impl Clone for Presentation
impl Clone for Presentation
Source§fn clone(&self) -> Presentation
fn clone(&self) -> Presentation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
Source§impl<'de> Deserialize<'de> for Presentation
impl<'de> Deserialize<'de> for Presentation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for Presentation
impl PartialEq for Presentation
Source§fn eq(&self, other: &Presentation) -> bool
fn eq(&self, other: &Presentation) -> bool
self and other values to be equal, and is used by ==.