pub struct Dimension(pub(crate) CompactLength);
Expand description
Tuple Fields§
§0: CompactLength
Implementations§
Source§impl Dimension
impl Dimension
Sourcepub const fn length(val: f32) -> Self
pub const fn length(val: f32) -> Self
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) -> Self
pub const fn percent(val: f32) -> Self
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() -> Self
pub const fn auto() -> Self
The dimension should be automatically computed according to algorithm-specific rules regarding the default size of boxes.
Sourcepub fn calc(ptr: *const ()) -> Self
pub fn calc(ptr: *const ()) -> Self
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) -> Self
pub unsafe fn from_raw(val: CompactLength) -> Self
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