pub struct LengthPercentage(pub(crate) CompactLength);
Expand description
Tuple Fields§
§0: CompactLength
Implementations§
Source§impl LengthPercentage
impl LengthPercentage
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 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 LengthPercentage from a raw CompactLength
.
§Safety
CompactLength must represent a valid variant for LengthPercentage
Sourcepub fn into_raw(self) -> CompactLength
pub fn into_raw(self) -> CompactLength
Get the underlying CompactLength
representation of the value
Trait Implementations§
Source§impl Clone for LengthPercentage
impl Clone for LengthPercentage
Source§fn clone(&self) -> LengthPercentage
fn clone(&self) -> LengthPercentage
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 LengthPercentage
impl Debug for LengthPercentage
Source§impl From<LengthPercentage> for Dimension
impl From<LengthPercentage> for Dimension
Source§fn from(input: LengthPercentage) -> Self
fn from(input: LengthPercentage) -> Self
Converts to this type from the input type.
Source§impl From<LengthPercentage> for LengthPercentageAuto
impl From<LengthPercentage> for LengthPercentageAuto
Source§fn from(input: LengthPercentage) -> Self
fn from(input: LengthPercentage) -> Self
Converts to this type from the input type.
Source§impl From<LengthPercentage> for MaxTrackSizingFunction
impl From<LengthPercentage> for MaxTrackSizingFunction
Source§fn from(input: LengthPercentage) -> Self
fn from(input: LengthPercentage) -> Self
Converts to this type from the input type.
Source§impl From<LengthPercentage> for TrackSizingFunction
impl From<LengthPercentage> for TrackSizingFunction
Source§fn from(input: LengthPercentage) -> Self
fn from(input: LengthPercentage) -> Self
Converts to this type from the input type.
Source§impl From<LengthPercentage> for MinTrackSizingFunction
impl From<LengthPercentage> for MinTrackSizingFunction
Source§fn from(input: LengthPercentage) -> Self
fn from(input: LengthPercentage) -> Self
Converts to this type from the input type.
Source§impl FromLength for LengthPercentage
impl FromLength for LengthPercentage
Source§impl FromPercent for LengthPercentage
impl FromPercent for LengthPercentage
Source§impl MaybeResolve<Option<f32>, Option<f32>> for LengthPercentage
impl MaybeResolve<Option<f32>, Option<f32>> for LengthPercentage
Source§impl PartialEq for LengthPercentage
impl PartialEq for LengthPercentage
Source§impl ResolveOrZero<Option<f32>, f32> for LengthPercentage
impl ResolveOrZero<Option<f32>, f32> for LengthPercentage
Source§impl TaffyZero for LengthPercentage
impl TaffyZero for LengthPercentage
impl Copy for LengthPercentage
impl StructuralPartialEq for LengthPercentage
Auto Trait Implementations§
impl Freeze for LengthPercentage
impl RefUnwindSafe for LengthPercentage
impl !Send for LengthPercentage
impl !Sync for LengthPercentage
impl Unpin for LengthPercentage
impl UnwindSafe for LengthPercentage
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