pub struct LengthPercentage(/* private fields */);Expand description
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 Takia 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
Available on crate feature calc only.
pub fn calc(ptr: *const ()) -> Self
calc only.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 const unsafe fn from_raw(val: CompactLength) -> Self
pub const unsafe fn from_raw(val: CompactLength) -> Self
Create a LengthPercentage from a raw CompactLength.
§Safety
CompactLength must represent a valid variant for LengthPercentage
Sourcepub const fn into_raw(self) -> CompactLength
pub const fn into_raw(self) -> CompactLength
Get the underlying CompactLength representation of the value
Sourcepub fn expand(self) -> ExpandedLengthPercentage
pub fn expand(self) -> ExpandedLengthPercentage
Expand the compact representation into an ExpandedLengthPercentage enum.
This is useful when integrating with other libraries (e.g. for style inspection or
serialization) as it allows the value to be pattern-matched without having to work
with the raw CompactLength tagged-pointer representation directly.
Trait Implementations§
Source§impl Clone for LengthPercentage
impl Clone for LengthPercentage
impl Copy for LengthPercentage
Source§impl Debug for LengthPercentage
impl Debug for LengthPercentage
Source§impl<'de> Deserialize<'de> for LengthPercentage
Available on crate feature serde only.
impl<'de> Deserialize<'de> for LengthPercentage
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl From<ExpandedLengthPercentage> for LengthPercentage
impl From<ExpandedLengthPercentage> for LengthPercentage
Source§fn from(value: ExpandedLengthPercentage) -> Self
fn from(value: ExpandedLengthPercentage) -> Self
Source§impl From<LengthPercentage> for ExpandedLengthPercentage
impl From<LengthPercentage> for ExpandedLengthPercentage
Source§fn from(value: LengthPercentage) -> Self
fn from(value: LengthPercentage) -> Self
Source§impl From<LengthPercentage> for LengthPercentageAuto
impl From<LengthPercentage> for LengthPercentageAuto
Source§fn from(input: LengthPercentage) -> Self
fn from(input: LengthPercentage) -> Self
Source§impl From<LengthPercentage> for Dimension
impl From<LengthPercentage> for Dimension
Source§fn from(input: LengthPercentage) -> Self
fn from(input: LengthPercentage) -> Self
Source§impl From<LengthPercentage> for MaxTrackSizingFunction
Available on crate feature grid only.
impl From<LengthPercentage> for MaxTrackSizingFunction
grid only.Source§fn from(input: LengthPercentage) -> Self
fn from(input: LengthPercentage) -> Self
Source§impl From<LengthPercentage> for MinTrackSizingFunction
Available on crate feature grid only.
impl From<LengthPercentage> for MinTrackSizingFunction
grid only.Source§fn from(input: LengthPercentage) -> Self
fn from(input: LengthPercentage) -> Self
Source§impl From<LengthPercentage> for TrackSizingFunction
Available on crate feature grid only.
impl From<LengthPercentage> for TrackSizingFunction
grid only.Source§fn from(input: LengthPercentage) -> Self
fn from(input: LengthPercentage) -> Self
Source§impl FromLength for LengthPercentage
impl FromLength for LengthPercentage
Source§impl FromPercent for LengthPercentage
impl FromPercent for LengthPercentage
Source§impl FromStr for LengthPercentage
Available on crate feature parse only.
impl FromStr for LengthPercentage
parse only.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 Serialize for LengthPercentage
Available on crate feature serde only.
impl Serialize for LengthPercentage
serde only.