Skip to main content

Env

Struct Env 

Source
pub struct Env { /* private fields */ }
Expand description

Everything widgets need to know about how to draw and label themselves.

Implementations§

Source§

impl Env

Source

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.

Source

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.

Source

pub fn theme(&self) -> &Theme

The active theme.

Source

pub fn themes(&self) -> Vec<(String, String)>

(id, name) of every theme.

Source

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.

Source

pub fn icons(&self) -> &Icons

The icons in the active glyph mode.

Source

pub fn icon_mode(&self) -> IconMode

The chosen icon mode.

Source

pub fn glyph_mode(&self) -> GlyphMode

The glyph column actually drawn.

Source

pub fn i18n(&self) -> &I18n

The translator.

Source

pub fn keymap(&self) -> &Keymap

The keymap.

Source

pub fn keymap_mut(&mut self) -> &mut Keymap

The keymap, to bind actions in code, e.g. before handing the environment to a Harness.

Source

pub fn depth(&self) -> ColorDepth

The terminal’s colour depth.

Source

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.

Source

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.

Source

pub fn pillar_style(&self) -> Option<PillarStyle>

The pillar the user chose over the theme’s, if any.

Source

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.

Source

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§

Source§

impl Clone for Env

Source§

fn clone(&self) -> Env

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Env

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.