pub struct MetricRole {
pub name: &'static str,
pub node: &'static str,
pub doc: &'static str,
pub get: fn(&Metrics) -> f32,
pub set: fn(&mut Metrics, f32),
pub platform: Option<PlatformValue>,
}Expand description
One size the stock widgets are built from (crate::metrics::Metrics), pinned the way ThemeRole pins a colour: a binding
iterates the rows to read or write a set, so a field added to
Metrics is one row here and nothing anywhere else. The test below
destructures the struct exhaustively.
Fields§
§name: &'static strThe Rust field, and the name used everywhere but Node.
node: &'static strWhat Node calls it (camelCase).
doc: &'static str§get: fn(&Metrics) -> f32§set: fn(&mut Metrics, f32)§platform: Option<PlatformValue>Some for a row whose stock value is the platform’s own rather
than a density’s: the value on Windows, then everywhere else.
get answers for the running platform; a generator prints the
pair, so docs/props.md reads the same whichever machine wrote it.
Stock and compact share it — the test below pins
that compact() leaves such a row alone.
Auto Trait Implementations§
impl Freeze for MetricRole
impl RefUnwindSafe for MetricRole
impl Send for MetricRole
impl Sync for MetricRole
impl Unpin for MetricRole
impl UnsafeUnpin for MetricRole
impl UnwindSafe for MetricRole
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> 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.