pub struct Env { /* private fields */ }Expand description
Everything widgets need to know about how to draw and label themselves.
Implementations§
Source§impl Env
impl Env
Sourcepub fn builtin() -> Self
pub fn builtin() -> Self
Built-in files only, the monochrome theme, Unicode glyphs, English and 24-bit colour.
Deterministic, which makes it the environment for tests.
Sourcepub fn load(dirs: &AssetDirs) -> Result<Self>
pub fn load(dirs: &AssetDirs) -> Result<Self>
Loads the application’s files over the built-ins and detects colour depth, glyphs and language from the process environment.
§Errors
Returns an I/O error when a configured directory or file cannot be read and no text was
given for that kind of file; with text given, an unreadable path is a diagnostic and the
text stands in for it. Problems inside files are never errors; they are collected in
Env::diagnostics.
Sourcepub fn icon_sets(&self) -> Vec<(String, String)>
pub fn icon_sets(&self) -> Vec<(String, String)>
(id, name) of every icon set, the way Env::themes lists the themes. A theme names
the set it draws with, so this tells which sets a theme may name.
Sourcepub fn glyph_mode(&self) -> GlyphMode
pub fn glyph_mode(&self) -> GlyphMode
The glyph column actually drawn.
Sourcepub fn keymap_mut(&mut self) -> &mut Keymap
pub fn keymap_mut(&mut self) -> &mut Keymap
The keymap, to bind actions in code, e.g. before handing the environment to a
Harness.
Sourcepub fn depth(&self) -> ColorDepth
pub fn depth(&self) -> ColorDepth
The terminal’s colour depth.
Sourcepub fn reduced_motion(&self) -> bool
pub fn reduced_motion(&self) -> bool
Whether animations are reduced: layers appear at once, nothing breathes or spins.
The QUVYTA_REDUCED_MOTION environment variable, read by Env::load, decides when it
is set: 0 keeps motion, any other non-empty value reduces it. It wins over a saved
reduced-motion setting and over Command::set_reduced_motion, because a choice made in
the user’s shell is the stronger signal, the way accessibility overrides work. Unset or
empty, the saved setting and the application decide.
Sourcepub fn reduced_motion_forced(&self) -> bool
pub fn reduced_motion_forced(&self) -> bool
Whether the QUVYTA_REDUCED_MOTION environment variable decides reduced motion, so neither
a saved setting nor Command::set_reduced_motion can change it. A settings screen uses it to
show its reduced-motion switch as decided by the environment instead of letting the switch
snap back when pressed.
Sourcepub fn pillar_style(&self) -> Option<PillarStyle>
pub fn pillar_style(&self) -> Option<PillarStyle>
The pillar the user chose over the theme’s, if any.
Sourcepub fn slide(&self) -> bool
pub fn slide(&self) -> bool
Whether list structures (lists, menus, trees, tables, tab strips and rails, dropdown options)
slide the leading text of hovered and selected rows one cell; buttons and fields never do.
The user’s choice when made, otherwise the theme’s motion.slide.
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
Problems found in theme, icon, locale and keymap files, including theme switches that fell back to the default.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Env
impl RefUnwindSafe for Env
impl Send for Env
impl Sync for Env
impl Unpin for Env
impl UnsafeUnpin for Env
impl UnwindSafe for Env
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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