pub struct SystemEnv {
pub appearance: Appearance,
pub accent: Option<Color>,
pub motion: MotionPref,
pub locale: Option<Locale>,
pub assistive: Assistive,
}Expand description
The user’s OS settings, as the host reports them. Not window facts and
not display facts: things the person chose once, in a settings app, that
a view is expected to honour. The core acts on two of them in one way:
appearance and accent derive the theme, so the stock
widgets and a <text> with no colour follow the OS — and nothing else
moves. Reduced motion does not shorten an animation and a dark
appearance repaints none of the app’s own colours: the view decides,
because only it knows which of its colours is the background and which
of its animations carries meaning.
Each field defaults to “the host cannot tell”, which is what a headless
core reports and what any driver reports for a fact its platform gives
it no way to ask. The kui-native runner asks the OS for all four on macOS and
Windows (the appearance through winit, the rest in its system_env);
elsewhere it answers what it can and leaves the rest unknown. The fifth,
Assistive, is not a setting but a fact of the same shape — the
user chose to run a screen reader — and comes from the accessibility
bridge rather than a settings query.
Fields§
§appearance: AppearanceLight or dark, when the host can tell.
accent: Option<Color>The OS accent/highlight colour, None when the host can’t tell.
motion: MotionPrefWhether the user asked for reduced motion.
locale: Option<Locale>The UI language as a BCP-47 tag, None when the host can’t tell.
assistive: AssistiveWhether assistive technology has asked for the access tree.
Implementations§
Source§impl SystemEnv
impl SystemEnv
Sourcepub fn over(self, base: SystemEnv) -> SystemEnv
pub fn over(self, base: SystemEnv) -> SystemEnv
self laid over base: every field self knows wins, every field
it left at “cannot tell” is base’s. The merge behind a launcher’s
pinned reading (kui_native::Launcher::system, Node’s runWindowed(.., {system}), the context a C host hands kui_run_with): the app’s
partial over what the OS answered, applied every frame where the
runner writes the real reading — so a pinned motion survives the
write, and a real change to the accent still arrives, because that
field was left unknown here and base is the OS’s.
Unknown means not pinned, which is why there is no separate
override type: the four “cannot tell” readings are the defaults, so
SystemEnv { motion: MotionPref::Reduced, ..Default::default() } is
the whole of “as if this user asked for less motion”. What it
cannot say is “pin this to unknown” — a window on a platform that
answers has no test that needs it.
Trait Implementations§
impl Copy for SystemEnv
impl StructuralPartialEq for SystemEnv
Auto Trait Implementations§
impl Freeze for SystemEnv
impl RefUnwindSafe for SystemEnv
impl Send for SystemEnv
impl Sync for SystemEnv
impl Unpin for SystemEnv
impl UnsafeUnpin for SystemEnv
impl UnwindSafe for SystemEnv
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.