pub struct EdgeSizes {
pub top: f32,
pub right: f32,
pub bottom: f32,
pub left: f32,
}Expand description
Represents the four edges of a box for properties like margin, padding, border.
Fields§
§top: f32§right: f32§bottom: f32§left: f32Implementations§
Source§impl EdgeSizes
impl EdgeSizes
Sourcepub fn horizontal_sum(&self) -> f32
pub fn horizontal_sum(&self) -> f32
Sum of horizontal edges (left + right).
Sourcepub fn vertical_sum(&self) -> f32
pub fn vertical_sum(&self) -> f32
Sum of vertical edges (top + bottom).
Sourcepub const fn main_start(&self, wm: LayoutWritingMode) -> f32
pub const fn main_start(&self, wm: LayoutWritingMode) -> f32
Returns the size of the edge at the start of the main/block axis.
Sourcepub const fn main_end(&self, wm: LayoutWritingMode) -> f32
pub const fn main_end(&self, wm: LayoutWritingMode) -> f32
Returns the size of the edge at the end of the main/block axis.
Sourcepub fn main_sum(&self, wm: LayoutWritingMode) -> f32
pub fn main_sum(&self, wm: LayoutWritingMode) -> f32
Returns the sum of the start and end sizes on the main/block axis.
Sourcepub const fn cross_start(&self, wm: LayoutWritingMode) -> f32
pub const fn cross_start(&self, wm: LayoutWritingMode) -> f32
Returns the size of the edge at the start of the cross/inline axis.
Sourcepub const fn cross_end(&self, wm: LayoutWritingMode) -> f32
pub const fn cross_end(&self, wm: LayoutWritingMode) -> f32
Returns the size of the edge at the end of the cross/inline axis.
Sourcepub fn cross_sum(&self, wm: LayoutWritingMode) -> f32
pub fn cross_sum(&self, wm: LayoutWritingMode) -> f32
Returns the sum of the start and end sizes on the cross/inline axis.
Sourcepub const fn line_over(&self, wm: LayoutWritingMode) -> f32
pub const fn line_over(&self, wm: LayoutWritingMode) -> f32
Returns the line-over edge (line-relative block-axis start).
Per CSS Writing Modes L4 §6.3, the line-over side is top in
horizontal-tb and right in both vertical writing modes. Unlike
Self::main_start (a physical block-axis accessor), this is the
line-relative over side and coincides with main_start only in
horizontal-tb.
Sourcepub const fn line_under(&self, wm: LayoutWritingMode) -> f32
pub const fn line_under(&self, wm: LayoutWritingMode) -> f32
Returns the line-under edge (line-relative block-axis end).
Per CSS Writing Modes L4 §6.3, the line-under side is bottom in
horizontal-tb and left in both vertical writing modes.
Sourcepub fn line_over_under_sum(&self, wm: LayoutWritingMode) -> f32
pub fn line_over_under_sum(&self, wm: LayoutWritingMode) -> f32
Returns the sum of the line-over and line-under edges.
Sourcepub const fn inline_start(
&self,
wm: LayoutWritingMode,
dir: StyleDirection,
) -> f32
pub const fn inline_start( &self, wm: LayoutWritingMode, dir: StyleDirection, ) -> f32
Returns the flow-relative inline-start edge.
The inline-start side is line-left (see Self::cross_start) when the
inline base direction is LTR, and line-right (see Self::cross_end)
when it is RTL. This is the direction-aware counterpart that
cross_start/cross_end (which are direction-blind line-left/line-right)
cannot express on their own.
Sourcepub const fn inline_end(
&self,
wm: LayoutWritingMode,
dir: StyleDirection,
) -> f32
pub const fn inline_end( &self, wm: LayoutWritingMode, dir: StyleDirection, ) -> f32
Returns the flow-relative inline-end edge.
The inline-end side is line-right when the inline base direction is
LTR, and line-left when it is RTL.
Sourcepub fn inline_sum(&self, wm: LayoutWritingMode, dir: StyleDirection) -> f32
pub fn inline_sum(&self, wm: LayoutWritingMode, dir: StyleDirection) -> f32
Returns the sum of the inline-start and inline-end edges.
Direction-independent (start + end covers the whole inline axis), but
takes dir for call-site symmetry with the individual accessors.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EdgeSizes
impl RefUnwindSafe for EdgeSizes
impl Send for EdgeSizes
impl Sync for EdgeSizes
impl Unpin for EdgeSizes
impl UnsafeUnpin for EdgeSizes
impl UnwindSafe for EdgeSizes
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