pub struct Dimension(/* private fields */);Expand description
Implementations§
Source§impl Dimension
impl Dimension
Sourcepub const fn length(val: f32) -> Dimension
pub const fn length(val: f32) -> Dimension
An absolute length in some abstract units. Users of Taffy may define what they correspond to in their application (pixels, logical pixels, mm, etc) as they see fit.
Sourcepub const fn percent(val: f32) -> Dimension
pub const fn percent(val: f32) -> Dimension
A percentage length relative to the size of the containing block.
NOTE: percentages are represented as a f32 value in the range [0.0, 1.0] NOT the range [0.0, 100.0]
Sourcepub const fn auto() -> Dimension
pub const fn auto() -> Dimension
The dimension should be automatically computed according to algorithm-specific rules regarding the default size of boxes.
Sourcepub fn calc(ptr: *const ()) -> Dimension
pub fn calc(ptr: *const ()) -> Dimension
A calc() value. The value passed here is treated as an opaque handle to
the actual calc representation and may be a pointer, index, etc.
The low 3 bits are used as a tag value and will be returned as 0.
Sourcepub unsafe fn from_raw(val: CompactLength) -> Dimension
pub unsafe fn from_raw(val: CompactLength) -> Dimension
Create a LengthPercentageAuto from a raw CompactLength.
§Safety
CompactLength must represent a valid variant for LengthPercentageAuto
Sourcepub fn into_raw(self) -> CompactLength
pub fn into_raw(self) -> CompactLength
Get the underlying CompactLength representation of the value
Sourcepub fn into_option(self) -> Option<f32>
pub fn into_option(self) -> Option<f32>
Get Length value if value is Length variant
Trait Implementations§
Source§impl From<LengthPercentage> for Dimension
impl From<LengthPercentage> for Dimension
Source§fn from(input: LengthPercentage) -> Dimension
fn from(input: LengthPercentage) -> Dimension
Source§impl From<LengthPercentageAuto> for Dimension
impl From<LengthPercentageAuto> for Dimension
Source§fn from(input: LengthPercentageAuto) -> Dimension
fn from(input: LengthPercentageAuto) -> Dimension
Source§impl FromLength for Dimension
impl FromLength for Dimension
Source§impl FromPercent for Dimension
impl FromPercent for Dimension
impl Copy for Dimension
impl StructuralPartialEq for Dimension
Auto Trait Implementations§
impl Freeze for Dimension
impl RefUnwindSafe for Dimension
impl !Send for Dimension
impl !Sync for Dimension
impl Unpin for Dimension
impl UnwindSafe for Dimension
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,
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>
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>
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)
&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)
&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> 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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.