#[non_exhaustive]pub enum DesignLanguage {
Material3,
Cupertino,
Glyph,
Custom(&'static str),
}Expand description
The design-token vocabulary: the Theme bundle plus its
component token tables, flat-re-exported from frust-theme so app code
never names that crate directly. A root component reads the active theme via
use_context::<Theme>(); a widget reads it during paint/layout via
PaintCtx::theme_as/LayoutCtx::theme_as (or Theme::from_paint_ctx).
Includes the glass material tokens — this crate ships the opaque recipe, and a design system authors its own translucent one over the same types:
use frust::GlassScale;
let glass = GlassScale::opaque_material();
assert_eq!(glass.chrome.blur_radius_intent, 0.0);
assert!(glass.control.is_opaque());Also the composable-theming surface:
ThemeBuilder (defineTheme/copyWith analog), the no-lock-in typed
extension slot (ThemeExtensions) plus its first consumer
StatusPalette/StatusColors (success/warning/info), and the motion
vocabulary (MotionDurations/EasingSet) — all flat-re-exported so an
app (or a design-system plugin) authors a theme against frust::* alone.
Which design language assembled a Theme — a Theme itself stays a
single, language-agnostic aggregate struct; this is just a tag app/shell
code can branch on (e.g. to pick per-platform interaction affordances),
not a second Theme type. No constructor in this crate produces anything
but the derived default: a design system sets its own tag through
ThemeBuilder::design_language
while assembling its baseline, from its own crate.
The tag is identity, not behavior: a design system styles itself entirely
via Theme‘s tokens plus Theme::extensions (see
ThemeExtensions) — this enum just
lets a host/widget recognize which system is active, or deliberately
ignore an unrecognized one. #[non_exhaustive] and Custom
together mean a new built-in variant, or a third-party system tagging
itself, is never a breaking change for downstream code: the built-in
==-based branch site (frust-widgets’ slider) already treats anything
that isn’t Cupertino as the neutral path by construction, so an
unrecognized Custom id falls through safely. Two Custom tags compare
equal by string content, not by pointer/interning identity.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Material3
Material 3 (Android/cross-platform baseline). Default — the tag
Theme::neutral carries for want of a neutral variant (see that
constructor’s caveat), and the one frust-material sets explicitly.
Cupertino
Cupertino (iOS) — the tag frust-cupertino sets.
Glyph
Glyph — the tag frust-glyph sets.
Custom(&'static str)
A third-party design system’s identity tag — the id is the system’s
stable name (e.g. "yaru"). Carried so hosts/widgets that branch on
language can recognize (or deliberately ignore) an external system;
the built-in == branch site (the slider) treats any Custom as the
neutral path by construction. Compared by string content —
Custom("yaru") == Custom("yaru") even across two distinct
&'static str allocations with the same bytes.
Trait Implementations§
Source§impl Clone for DesignLanguage
impl Clone for DesignLanguage
Source§fn clone(&self) -> DesignLanguage
fn clone(&self) -> DesignLanguage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DesignLanguage
Source§impl Debug for DesignLanguage
impl Debug for DesignLanguage
Source§impl Default for DesignLanguage
impl Default for DesignLanguage
Source§fn default() -> DesignLanguage
fn default() -> DesignLanguage
impl Eq for DesignLanguage
Source§impl PartialEq for DesignLanguage
impl PartialEq for DesignLanguage
impl StructuralPartialEq for DesignLanguage
Auto Trait Implementations§
impl Freeze for DesignLanguage
impl RefUnwindSafe for DesignLanguage
impl Send for DesignLanguage
impl Sync for DesignLanguage
impl Unpin for DesignLanguage
impl UnsafeUnpin for DesignLanguage
impl UnwindSafe for DesignLanguage
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<T> Brush for 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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.