pub struct CompactLength(/* private fields */);Expand description
A representation of a length as a compact 64-bit tagged pointer
Implementations§
Source§impl CompactLength
impl CompactLength
Sourcepub const LENGTH_TAG: usize = 0b0000_0001
pub const LENGTH_TAG: usize = 0b0000_0001
The tag indicating a length value
Sourcepub const PERCENT_TAG: usize = 0b0000_0010
pub const PERCENT_TAG: usize = 0b0000_0010
The tag indicating a percentage value
Sourcepub const MIN_CONTENT_TAG: usize = 0b00000111
pub const MIN_CONTENT_TAG: usize = 0b00000111
The tag indicating a min-content value
Sourcepub const MAX_CONTENT_TAG: usize = 0b00001111
pub const MAX_CONTENT_TAG: usize = 0b00001111
The tag indicating a max-content value
Sourcepub const FIT_CONTENT_PX_TAG: usize = 0b00010111
pub const FIT_CONTENT_PX_TAG: usize = 0b00010111
The tag indicating a fit-content value with px limit
Sourcepub const FIT_CONTENT_PERCENT_TAG: usize = 0b00011111
pub const FIT_CONTENT_PERCENT_TAG: usize = 0b00011111
The tag indicating a fit-content value with percent limit
Source§impl CompactLength
impl CompactLength
Sourcepub const fn length(val: f32) -> CompactLength
pub const fn length(val: f32) -> CompactLength
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) -> CompactLength
pub const fn percent(val: f32) -> CompactLength
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 ()) -> CompactLength
pub fn calc(ptr: *const ()) -> CompactLength
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 fn auto() -> CompactLength
pub const fn auto() -> CompactLength
The dimension should be automatically computed according to algorithm-specific rules regarding the default size of boxes.
Sourcepub const fn fr(val: f32) -> CompactLength
pub const fn fr(val: f32) -> CompactLength
The dimension as a fraction of the total available grid space (fr units in CSS)
Specified value is the numerator of the fraction. Denominator is the sum of all fraction specified in that grid dimension
Spec: https://www.w3.org/TR/css3-grid-layout/#fr-unit
Sourcepub const fn min_content() -> CompactLength
pub const fn min_content() -> CompactLength
The size should be the “min-content” size. This is the smallest size that can fit the item’s contents with ALL soft line-wrapping opportunities taken
Sourcepub const fn max_content() -> CompactLength
pub const fn max_content() -> CompactLength
The size should be the “max-content” size. This is the smallest size that can fit the item’s contents with NO soft line-wrapping opportunities taken
Sourcepub const fn fit_content_px(limit: f32) -> CompactLength
pub const fn fit_content_px(limit: f32) -> CompactLength
The size should be computed according to the “fit content” formula:
max(min_content, min(max_content, limit))
where:
min_contentis the min-content sizemax_contentis the max-content sizelimitis a LENGTH value passed to this function
The effect of this is that the item takes the size of limit clamped
by the min-content and max-content sizes.
Sourcepub const fn fit_content_percent(limit: f32) -> CompactLength
pub const fn fit_content_percent(limit: f32) -> CompactLength
The size should be computed according to the “fit content” formula:
max(min_content, min(max_content, limit))
where:
min_contentis the min-content sizemax_contentis the max-content sizelimitis a PERCENTAGE value passed to this function
The effect of this is that the item takes the size of limit clamped
by the min-content and max-content sizes.
Sourcepub fn value(self) -> f32
pub fn value(self) -> f32
Get the numeric value associated with the CompactLength
(e.g. the pixel value for a LENGTH variant)
Sourcepub fn calc_value(self) -> *const ()
pub fn calc_value(self) -> *const ()
Get the calc pointer of the CompactLength
Sourcepub fn is_length_or_percentage(self) -> bool
pub fn is_length_or_percentage(self) -> bool
Returns true if the value is a length or percentage value
Sourcepub fn is_min_content(self) -> bool
pub fn is_min_content(self) -> bool
Returns true if the value is min-content
Sourcepub fn is_max_content(self) -> bool
pub fn is_max_content(self) -> bool
Returns true if the value is max-content
Sourcepub fn is_fit_content(self) -> bool
pub fn is_fit_content(self) -> bool
Returns true if the value is a fit-content(…) value
Sourcepub fn is_max_or_fit_content(self) -> bool
pub fn is_max_or_fit_content(self) -> bool
Returns true if the value is max-content or a fit-content(…) value
Sourcepub fn is_max_content_alike(&self) -> bool
pub fn is_max_content_alike(&self) -> bool
Returns true if the max track sizing function is MaxContent, FitContent or Auto else false.
“In all cases, treat auto and fit-content() as max-content, except where specified otherwise for fit-content().”
See: https://www.w3.org/TR/css-grid-1/#algo-terms
Sourcepub fn is_min_or_max_content(&self) -> bool
pub fn is_min_or_max_content(&self) -> bool
Returns true if the min track sizing function is MinContent or MaxContent, else false.
Sourcepub fn is_intrinsic(self) -> bool
pub fn is_intrinsic(self) -> bool
Returns true if the value is auto, min-content, max-content, or fit-content(…)
Sourcepub fn uses_percentage(self) -> bool
pub fn uses_percentage(self) -> bool
Whether the track sizing functions depends on the size of the parent node
Trait Implementations§
Source§impl Clone for CompactLength
impl Clone for CompactLength
Source§fn clone(&self) -> CompactLength
fn clone(&self) -> CompactLength
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompactLength
impl Debug for CompactLength
Source§impl FromFr for CompactLength
impl FromFr for CompactLength
Source§impl FromLength for CompactLength
impl FromLength for CompactLength
Source§fn from_length<Input>(value: Input) -> CompactLength
fn from_length<Input>(value: Input) -> CompactLength
Into<f32> into SelfSource§impl FromPercent for CompactLength
impl FromPercent for CompactLength
Source§fn from_percent<Input>(value: Input) -> CompactLength
fn from_percent<Input>(value: Input) -> CompactLength
Into<f32> into SelfSource§impl PartialEq for CompactLength
impl PartialEq for CompactLength
Source§fn eq(&self, other: &CompactLength) -> bool
fn eq(&self, other: &CompactLength) -> bool
self and other values to be equal, and is used by ==.Source§impl TaffyAuto for CompactLength
impl TaffyAuto for CompactLength
Source§const AUTO: CompactLength
const AUTO: CompactLength
Source§impl TaffyFitContent for CompactLength
impl TaffyFitContent for CompactLength
Source§fn fit_content(lp: LengthPercentage) -> CompactLength
fn fit_content(lp: LengthPercentage) -> CompactLength
Source§impl TaffyMaxContent for CompactLength
impl TaffyMaxContent for CompactLength
Source§const MAX_CONTENT: CompactLength
const MAX_CONTENT: CompactLength
Source§impl TaffyMinContent for CompactLength
impl TaffyMinContent for CompactLength
Source§const MIN_CONTENT: CompactLength
const MIN_CONTENT: CompactLength
Source§impl TaffyZero for CompactLength
impl TaffyZero for CompactLength
Source§const ZERO: CompactLength
const ZERO: CompactLength
impl Copy for CompactLength
impl StructuralPartialEq for CompactLength
Auto Trait Implementations§
impl Freeze for CompactLength
impl RefUnwindSafe for CompactLength
impl !Send for CompactLength
impl !Sync for CompactLength
impl Unpin for CompactLength
impl UnsafeUnpin for CompactLength
impl UnwindSafe for CompactLength
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> 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<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>
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>
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