#[repr(C)]pub struct PackedBoxProps {
pub margin: [i16; 4],
pub padding: [i16; 4],
pub border: [i16; 4],
pub margin_auto: MarginAuto,
}Expand description
Packed representation of box model properties using i16×10 encoding.
Stores margin/padding/border as i16 values scaled by 10 (0.1px precision), reducing the hot struct from 52B to 26B. Range: ±3276.7px per edge.
Only used for storage in LayoutNodeHot. The layout solver unpacks to
ResolvedBoxProps (f32) for computation.
Fields§
§margin: [i16; 4]§padding: [i16; 4]§border: [i16; 4]§margin_auto: MarginAutoImplementations§
Source§impl PackedBoxProps
impl PackedBoxProps
Sourcepub fn pack(bp: &ResolvedBoxProps) -> Self
pub fn pack(bp: &ResolvedBoxProps) -> Self
Pack a ResolvedBoxProps into compact i16×10 encoding.
Sourcepub fn unpack(&self) -> ResolvedBoxProps
pub fn unpack(&self) -> ResolvedBoxProps
Unpack to full ResolvedBoxProps with f32 values.
Sourcepub fn inner_size(
&self,
outer_size: LogicalSize,
wm: LayoutWritingMode,
) -> LogicalSize
pub fn inner_size( &self, outer_size: LogicalSize, wm: LayoutWritingMode, ) -> LogicalSize
Convenience: unpack and call inner_size on the result.
Sourcepub fn content_box(&self, border_box: LogicalRect) -> LogicalRect
pub fn content_box(&self, border_box: LogicalRect) -> LogicalRect
Convenience: unpack and call content_box on the result.
Sourcepub fn padding_box(&self, border_box: LogicalRect) -> LogicalRect
pub fn padding_box(&self, border_box: LogicalRect) -> LogicalRect
Convenience: unpack and call padding_box on the result.
Sourcepub fn margin_box(&self, border_box: LogicalRect) -> LogicalRect
pub fn margin_box(&self, border_box: LogicalRect) -> LogicalRect
Convenience: unpack and call margin_box on the result.
Sourcepub fn horizontal_mbp(&self) -> f32
pub fn horizontal_mbp(&self) -> f32
Convenience: unpack and return horizontal MBP.
Sourcepub fn vertical_mbp(&self) -> f32
pub fn vertical_mbp(&self) -> f32
Convenience: unpack and return vertical MBP.
Sourcepub fn horizontal_bp(&self) -> f32
pub fn horizontal_bp(&self) -> f32
Convenience: unpack and return horizontal BP.
Sourcepub fn vertical_bp(&self) -> f32
pub fn vertical_bp(&self) -> f32
Convenience: unpack and return vertical BP.
Trait Implementations§
Source§impl Clone for PackedBoxProps
impl Clone for PackedBoxProps
Source§fn clone(&self) -> PackedBoxProps
fn clone(&self) -> PackedBoxProps
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 PackedBoxProps
impl Debug for PackedBoxProps
Source§impl Default for PackedBoxProps
impl Default for PackedBoxProps
Source§fn default() -> PackedBoxProps
fn default() -> PackedBoxProps
impl Copy for PackedBoxProps
Auto Trait Implementations§
impl Freeze for PackedBoxProps
impl RefUnwindSafe for PackedBoxProps
impl Send for PackedBoxProps
impl Sync for PackedBoxProps
impl Unpin for PackedBoxProps
impl UnsafeUnpin for PackedBoxProps
impl UnwindSafe for PackedBoxProps
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> 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