Struct Spacing
pub struct Spacing {
pub s0: f32,
pub s1: f32,
pub s2: f32,
pub s3: f32,
pub s4: f32,
pub s6: f32,
pub s8: f32,
pub s12: f32,
pub s16: f32,
pub rhythm: RhythmScale,
}Expand description
The 4 px spacing scale every gap, inset and gutter is drawn from.
Copy so a const context can read a step (Spacing::BASE.s3) for the
handful of chrome constants that must be compile-time values; everything
with a Theme in hand reads theme.tokens.spacing.*, which is already
scaled by crate::Theme::with_ui_scale and by a custom theme’s
spacing_px.
Fields§
§s0: f32§s1: f32§s2: f32§s3: f32§s4: f32§s6: f32§s8: f32§s12: f32§s16: f32§rhythm: RhythmScaleThe scale named by relationship: how far apart two things are follows from how they relate, so one relationship never carries two different gaps.
Implementations§
§impl Spacing
impl Spacing
pub const BASE: Spacing
pub const BASE: Spacing
Unscaled reference scale: 0 / 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64.
Spacing::default returns this; a const that has to agree with
a token (a shell breakpoint composed from a gutter, say) reads it
directly instead of restating the number.
pub fn step(&self, step: SpacingStep) -> f32
pub fn step(&self, step: SpacingStep) -> f32
The step’s value on this (possibly scaled) scale.
Trait Implementations§
impl Copy for Spacing
impl StructuralPartialEq for Spacing
Auto Trait Implementations§
impl Freeze for Spacing
impl RefUnwindSafe for Spacing
impl Send for Spacing
impl Sync for Spacing
impl Unpin for Spacing
impl UnsafeUnpin for Spacing
impl UnwindSafe for Spacing
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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