pub struct LogicalSides {
pub top: u16,
pub bottom: u16,
pub start: u16,
pub end: u16,
}Expand description
Padding or margin expressed in logical (direction-aware) terms.
start and end resolve to physical left and right (swapped in RTL).
top and bottom are direction-independent.
Fields§
§top: u16§bottom: u16§start: u16Inline start: left in LTR, right in RTL.
end: u16Inline end: right in LTR, left in RTL.
Implementations§
Source§impl LogicalSides
impl LogicalSides
Sourcepub const fn symmetric(block: u16, inline: u16) -> Self
pub const fn symmetric(block: u16, inline: u16) -> Self
Inline (start/end) sides equal, block (top/bottom) sides equal.
Sourcepub const fn resolve(self, flow: FlowDirection) -> Sides
pub const fn resolve(self, flow: FlowDirection) -> Sides
Resolve to physical Sides given the flow direction.
- LTR: start → left, end → right
- RTL: start → right, end → left
Sourcepub const fn inline_sum(self) -> u16
pub const fn inline_sum(self) -> u16
The sum of inline (start + end) sides.
Source§impl LogicalSides
Create LogicalSides from physical Sides under a given direction.
impl LogicalSides
Create LogicalSides from physical Sides under a given direction.
Inverse of LogicalSides::resolve.
pub const fn from_physical(sides: Sides, flow: FlowDirection) -> Self
Trait Implementations§
Source§impl Clone for LogicalSides
impl Clone for LogicalSides
Source§fn clone(&self) -> LogicalSides
fn clone(&self) -> LogicalSides
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LogicalSides
impl Debug for LogicalSides
Source§impl Default for LogicalSides
impl Default for LogicalSides
Source§fn default() -> LogicalSides
fn default() -> LogicalSides
Returns the “default value” for a type. Read more
Source§impl PartialEq for LogicalSides
impl PartialEq for LogicalSides
impl Copy for LogicalSides
impl Eq for LogicalSides
impl StructuralPartialEq for LogicalSides
Auto Trait Implementations§
impl Freeze for LogicalSides
impl RefUnwindSafe for LogicalSides
impl Send for LogicalSides
impl Sync for LogicalSides
impl Unpin for LogicalSides
impl UnwindSafe for LogicalSides
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
Mutably borrows from an owned value. Read more