Skip to main content

LogicalSides

Struct LogicalSides 

Source
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: u16

Inline start: left in LTR, right in RTL.

§end: u16

Inline end: right in LTR, left in RTL.

Implementations§

Source§

impl LogicalSides

Source

pub const fn all(val: u16) -> Self

All sides equal.

Source

pub const fn symmetric(block: u16, inline: u16) -> Self

Inline (start/end) sides equal, block (top/bottom) sides equal.

Source

pub const fn inline(start: u16, end: u16) -> Self

Set only inline (start/end) sides.

Source

pub const fn block(top: u16, bottom: u16) -> Self

Set only block (top/bottom) sides.

Source

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
Source

pub const fn inline_sum(self) -> u16

The sum of inline (start + end) sides.

Source

pub const fn block_sum(self) -> u16

The sum of block (top + bottom) sides.

Source§

impl LogicalSides

Create LogicalSides from physical Sides under a given direction.

Source

pub const fn from_physical(sides: Sides, flow: FlowDirection) -> Self

Trait Implementations§

Source§

impl Clone for LogicalSides

Source§

fn clone(&self) -> LogicalSides

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LogicalSides

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LogicalSides

Source§

fn default() -> LogicalSides

Returns the “default value” for a type. Read more
Source§

impl PartialEq for LogicalSides

Source§

fn eq(&self, other: &LogicalSides) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for LogicalSides

Source§

impl Eq for LogicalSides

Source§

impl StructuralPartialEq for LogicalSides

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.