pub enum LengthAuto {
Px(f32),
Percent(f32),
Auto,
Vw(f32),
Vh(f32),
Vmin(f32),
Vmax(f32),
}Expand description
Length value that can also be Auto (for margins/insets).
Similar to Length but allows automatic positioning.
Variants§
Px(f32)
Fixed pixel value
Percent(f32)
Percentage of parent size (0.0 - 100.0)
Auto
Automatic positioning
Vw(f32)
Percentage of viewport width (0.0 - 100.0)
Vh(f32)
Percentage of viewport height (0.0 - 100.0)
Vmin(f32)
Percentage of smaller viewport dimension (0.0 - 100.0)
Vmax(f32)
Percentage of larger viewport dimension (0.0 - 100.0)
Implementations§
Source§impl LengthAuto
impl LengthAuto
Sourcepub fn vmin(value: f32) -> Self
pub fn vmin(value: f32) -> Self
Create a viewport minimum length (1vmin = 1% of smaller viewport dimension).
Sourcepub fn vmax(value: f32) -> Self
pub fn vmax(value: f32) -> Self
Create a viewport maximum length (1vmax = 1% of larger viewport dimension).
Sourcepub fn to_length_percentage_auto(self) -> LengthPercentageAuto
pub fn to_length_percentage_auto(self) -> LengthPercentageAuto
Convert to Taffy LengthPercentageAuto.
§Panics
Panics if called on viewport-relative units (Vw/Vh/Vmin/Vmax).
These must be resolved to pixels first using LengthAuto::resolve.
Sourcepub fn from_length_percentage_auto(lpa: LengthPercentageAuto) -> Self
pub fn from_length_percentage_auto(lpa: LengthPercentageAuto) -> Self
Convert from Taffy LengthPercentageAuto.
Trait Implementations§
Source§impl Clone for LengthAuto
impl Clone for LengthAuto
Source§fn clone(&self) -> LengthAuto
fn clone(&self) -> LengthAuto
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LengthAuto
impl Debug for LengthAuto
Source§impl Display for LengthAuto
impl Display for LengthAuto
Source§impl From<Length> for LengthAuto
impl From<Length> for LengthAuto
Source§impl From<LengthAuto> for Constraint
impl From<LengthAuto> for Constraint
Source§fn from(length: LengthAuto) -> Self
fn from(length: LengthAuto) -> Self
Converts to this type from the input type.
Source§impl From<LengthAuto> for LengthPercentageAuto
impl From<LengthAuto> for LengthPercentageAuto
Source§fn from(length: LengthAuto) -> Self
fn from(length: LengthAuto) -> Self
Converts to this type from the input type.
Source§impl From<f32> for LengthAuto
impl From<f32> for LengthAuto
Source§impl PartialEq for LengthAuto
impl PartialEq for LengthAuto
impl Copy for LengthAuto
impl StructuralPartialEq for LengthAuto
Auto Trait Implementations§
impl Freeze for LengthAuto
impl RefUnwindSafe for LengthAuto
impl Send for LengthAuto
impl Sync for LengthAuto
impl Unpin for LengthAuto
impl UnsafeUnpin for LengthAuto
impl UnwindSafe for LengthAuto
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
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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