pub enum LengthBase {
Px(f32),
Vw(f32),
Vh(f32),
Vmin(f32),
Vmax(f32),
Em(f32),
}Expand description
One of the pure relative-or-absolute modes a Length can carry.
Split out so Length itself can stay Copy while still supporting
optional clamp bounds — the recursive Clamp variant of the original
sketch would have forced a Box allocation, which on a widget tree
that builds these values per frame is the wrong trade.
Variants§
Px(f32)
Absolute, in logical pixels.
Vw(f32)
Percentage of the viewport’s width (Vw(10.0) == 10 % of width).
Vh(f32)
Percentage of the viewport’s height.
Vmin(f32)
Percentage of the viewport’s smaller dimension. The right default for typography and gutters that must survive a portrait/landscape rotation without growing absurd.
Vmax(f32)
Percentage of the viewport’s larger dimension.
Em(f32)
Multiple of the root font size (typographic hierarchy: a heading
of Em(2.0) is twice the body size, regardless of viewport).
Trait Implementations§
Source§impl Clone for LengthBase
impl Clone for LengthBase
Source§fn clone(&self) -> LengthBase
fn clone(&self) -> LengthBase
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LengthBase
impl Debug for LengthBase
Source§impl From<LengthBase> for Length
impl From<LengthBase> for Length
Source§fn from(base: LengthBase) -> Self
fn from(base: LengthBase) -> Self
Source§impl PartialEq for LengthBase
impl PartialEq for LengthBase
impl Copy for LengthBase
impl StructuralPartialEq for LengthBase
Auto Trait Implementations§
impl Freeze for LengthBase
impl RefUnwindSafe for LengthBase
impl Send for LengthBase
impl Sync for LengthBase
impl Unpin for LengthBase
impl UnwindSafe for LengthBase
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
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