pub struct Root { /* private fields */ }Expand description
The root of a Rust app: makes the app’s top component (on the engine
thread, where elements live). The engine mounts it as the content of the
surface (nsh_engine::App::Rust).
Implementations§
Source§impl Root
impl Root
Sourcepub fn new<C>(
props: impl Fn() -> <C as Component>::Props + Send + Sync + 'static,
) -> Rootwhere
C: Component,
pub fn new<C>(
props: impl Fn() -> <C as Component>::Props + Send + Sync + 'static,
) -> Rootwhere
C: Component,
Component C with the props props makes.
Sourcepub fn app_id(self, id: impl Into<String>) -> Root
pub fn app_id(self, id: impl Into<String>) -> Root
The app’s id (nsh.json "id", which nsh’s generated code sets):
it names where the app keeps its data (nsh/storage).
Sourcepub fn app_id_ref(&self) -> Option<&str>
pub fn app_id_ref(&self) -> Option<&str>
The app’s id (Root::app_id).
Sourcepub fn tokens(self, tokens: Tokens) -> Root
pub fn tokens(self, tokens: Tokens) -> Root
Renders with design tokens tokens (nsh-base‘s theme’s; by
default the UI sets’ defaults).
Sourcepub fn font(self, data: impl Into<Arc<[u8]>>) -> Root
pub fn font(self, data: impl Into<Arc<[u8]>>) -> Root
Registers a font file (TrueType / OpenType) before the first render; styles name it by its family name.
Sourcepub fn appearance(self, appearance: Appearance) -> Root
pub fn appearance(self, appearance: Appearance) -> Root
Shows the app in appearance whatever the system’s (nsh.json
"appearance"; later super::set_color_scheme calls
change it).
Sourcepub fn status_bar(self, setting: StatusBarSetting) -> Root
pub fn status_bar(self, setting: StatusBarSetting) -> Root
The status bar’s default (nsh.json "statusBar"), under what
pages and dialogs set (Screen::status_bar, Modal::status_bar).
Sourcepub fn status_bar_ref(&self) -> Option<StatusBarSetting>
pub fn status_bar_ref(&self) -> Option<StatusBarSetting>
The status bar’s default (Root::status_bar).
Sourcepub fn appearance_ref(&self) -> Option<Appearance>
pub fn appearance_ref(&self) -> Option<Appearance>
The appearance it starts in (Root::appearance; None: the
system’s).
Sourcepub fn tokens_ref(&self) -> Option<&Tokens>
pub fn tokens_ref(&self) -> Option<&Tokens>
The design tokens it renders with.