Struct CompactLength
pub struct CompactLength(/* private fields */);Expand description
A representation of a length as a compact 64-bit tagged pointer
Implementations§
§impl CompactLength
impl CompactLength
pub const LENGTH_TAG: usize = 0b0000_0001
pub const LENGTH_TAG: usize = 0b0000_0001
The tag indicating a length value
pub const PERCENT_TAG: usize = 0b0000_0010
pub const PERCENT_TAG: usize = 0b0000_0010
The tag indicating a percentage value
pub const MIN_CONTENT_TAG: usize = 0b00000111
pub const MIN_CONTENT_TAG: usize = 0b00000111
The tag indicating a min-content value
pub const MAX_CONTENT_TAG: usize = 0b00001111
pub const MAX_CONTENT_TAG: usize = 0b00001111
The tag indicating a max-content value
pub 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
pub 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
§impl CompactLength
impl CompactLength
pub 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.
pub 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]
pub 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.
pub 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.
pub 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
pub 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
pub 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
pub 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.
pub 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.
pub 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)
pub fn calc_value(self) -> *const ()
pub fn calc_value(self) -> *const ()
Get the calc pointer of the CompactLength
pub 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
pub fn is_min_content(self) -> bool
pub fn is_min_content(self) -> bool
Returns true if the value is min-content
pub fn is_max_content(self) -> bool
pub fn is_max_content(self) -> bool
Returns true if the value is max-content
pub fn is_fit_content(self) -> bool
pub fn is_fit_content(self) -> bool
Returns true if the value is a fit-content(…) value
pub 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
pub 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
pub 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.
pub 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(…)
pub 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§
§impl Clone for CompactLength
impl Clone for CompactLength
§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 more§impl Debug for CompactLength
impl Debug for CompactLength
§impl FromFr for CompactLength
impl FromFr for CompactLength
§impl FromLength for CompactLength
impl FromLength for CompactLength
§fn from_length<Input>(value: Input) -> CompactLength
fn from_length<Input>(value: Input) -> CompactLength
Into<f32> into Self§impl FromPercent for CompactLength
impl FromPercent for CompactLength
§fn from_percent<Input>(value: Input) -> CompactLength
fn from_percent<Input>(value: Input) -> CompactLength
Into<f32> into Self§impl PartialEq for CompactLength
impl PartialEq for CompactLength
§impl TaffyAuto for CompactLength
impl TaffyAuto for CompactLength
§const AUTO: CompactLength
const AUTO: CompactLength
§impl TaffyFitContent for CompactLength
impl TaffyFitContent for CompactLength
§fn fit_content(lp: LengthPercentage) -> CompactLength
fn fit_content(lp: LengthPercentage) -> CompactLength
§impl TaffyMaxContent for CompactLength
impl TaffyMaxContent for CompactLength
§const MAX_CONTENT: CompactLength
const MAX_CONTENT: CompactLength
§impl TaffyMinContent for CompactLength
impl TaffyMinContent for CompactLength
§const MIN_CONTENT: CompactLength
const MIN_CONTENT: CompactLength
§impl TaffyZero for CompactLength
impl TaffyZero for CompactLength
§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§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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