Skip to main content

LogicalEdges

Struct LogicalEdges 

Source
pub struct LogicalEdges {
    pub top: f32,
    pub bottom: f32,
    pub start: f32,
    pub end: f32,
}
Expand description

Direction-aware logical edge insets in density-independent units (dp).

Shared across components to avoid duplicating per-component padding structs.

Fields§

§top: f32

Top edge inset in logical units.

§bottom: f32

Bottom edge inset in logical units.

§start: f32

Inline-start edge inset (left in LTR, right in RTL).

§end: f32

Inline-end edge inset (right in LTR, left in RTL).

Implementations§

Source§

impl LogicalEdges

Source

pub const ZERO: Self

Zero insets on all four sides.

Source

pub const fn all(value: f32) -> Self

Creates uniform insets on all four sides, clamping invalid or negative values to 0.0.

Source

pub const fn symmetric(horizontal: f32, vertical: f32) -> Self

Creates symmetric insets from horizontal (start/end) and vertical (top/bottom).

Source

pub const fn new(top: f32, end: f32, bottom: f32, start: f32) -> Self

Creates explicit logical insets in CSS-like (top, end, bottom, start) order.

Source

pub const fn top(self, value: f32) -> Self

Sets the top inset.

Source

pub const fn bottom(self, value: f32) -> Self

Sets the bottom inset.

Source

pub const fn start(self, value: f32) -> Self

Sets the inline-start inset.

Source

pub const fn end(self, value: f32) -> Self

Sets the inline-end inset.

Source

pub const fn horizontal(self, value: f32) -> Self

Sets both start and end insets.

Source

pub const fn vertical(self, value: f32) -> Self

Sets both top and bottom insets.

Source

pub const fn sanitize(self) -> Self

Returns a copy with every side sanitized via non_negative_f32.

Source

pub const fn resolve(self, direction: Direction) -> [f32; 4]

Resolves sanitized insets to physical [top, right, bottom, left] order for direction.

Trait Implementations§

Source§

impl Clone for LogicalEdges

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for LogicalEdges

Source§

impl Debug for LogicalEdges

Source§

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

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

impl Default for LogicalEdges

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for LogicalEdges

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for LogicalEdges

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for LogicalEdges

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for LogicalEdges

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.