pub enum ColorToken {
Value {
light: Color,
dark: Color,
},
Derived {
from: TokenRef,
ops: OpRange,
},
}Expand description
A colour token: one value per base, or a recipe over an earlier token
or a theme role. ColorToken::same is the unthemed case,
and what a declaration with one colour builds; a derived one is built
by Tokens::derive, since its source is an index into the table
that holds it.
Variants§
Value
Derived
from, with the ops at ops in Tokens’ chain applied in
order. from is a colour token declared before this one in the
same table, or a theme role — never a later token, so the chain is
acyclic by construction and a read recurses at most the table’s
length.
Implementations§
Source§impl ColorToken
impl ColorToken
pub fn same(c: Color) -> ColorToken
pub fn themed(light: Color, dark: Color) -> ColorToken
Sourcepub fn halves(&self) -> Option<(Color, Color)>
pub fn halves(&self) -> Option<(Color, Color)>
The declared halves of a value token; None for a derived one,
whose halves are whatever its recipe makes of its source’s
(Tokens::halves).
pub fn is_derived(&self) -> bool
Trait Implementations§
Source§impl Clone for ColorToken
impl Clone for ColorToken
Source§fn clone(&self) -> ColorToken
fn clone(&self) -> ColorToken
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ColorToken
Source§impl Debug for ColorToken
impl Debug for ColorToken
Source§impl PartialEq for ColorToken
impl PartialEq for ColorToken
impl StructuralPartialEq for ColorToken
Auto Trait Implementations§
impl Freeze for ColorToken
impl RefUnwindSafe for ColorToken
impl Send for ColorToken
impl Sync for ColorToken
impl Unpin for ColorToken
impl UnsafeUnpin for ColorToken
impl UnwindSafe for ColorToken
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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.