Skip to main content

Edges

Struct Edges 

Source
pub struct Edges {
    pub left: f32,
    pub right: f32,
    pub top: f32,
    pub bottom: f32,
    pub inline_start: Option<f32>,
    pub inline_end: Option<f32>,
    pub block_start: Option<f32>,
    pub block_end: Option<f32>,
    pub pct_left: Option<f32>,
    pub pct_right: Option<f32>,
    pub pct_top: Option<f32>,
    pub pct_bottom: Option<f32>,
}
Expand description

Per-edge length values (padding, margin, border). Physical edges (left / right / top / bottom) carry the authored values; the optional *_inline_* / *_block_* fields override them per writing direction (W5.5 - CSS Logical Properties Level 1 subset).

Edges::resolved(dir) collapses the logical fields onto the physical ones for the layout backend. When a logical override is None the physical field wins (back-compat for every existing callsite).

PartialEq is hand-written with NaN-tolerant semantics: NaN is the canonical “unset / auto” sentinel for inset edges (edges_to_lpa NaN-checks), and IEEE NaN != NaN made any two identical auto-inset styles compare unequal - which defeated every “did the Style actually change?” gate downstream (the taffy style cache re-pushed all virtualized rows on every dirty tick; equality-gated Style inserts re-fired forever).

Fields§

§left: f32

Left edge.

§right: f32

Right edge.

§top: f32

Top edge.

§bottom: f32

Bottom edge.

§inline_start: Option<f32>

*-inline-start - maps to left under LTR, right under RTL.

§inline_end: Option<f32>

*-inline-end - maps to right under LTR, left under RTL.

§block_start: Option<f32>

*-block-start - alias for top (no vertical writing modes yet).

§block_end: Option<f32>

*-block-end - alias for bottom.

§pct_left: Option<f32>

CSS percent unit for the left edge. When Some(pct) the side resolves as pct% per CSS (padding/margin percentages resolve against the containing block’s width; the layout backend hands taffy a LengthPercentage::percent) and the px field for the side is ignored. None = the px field is authoritative (fast path, unchanged behaviour).

§pct_right: Option<f32>§pct_top: Option<f32>§pct_bottom: Option<f32>

Implementations§

Source§

impl Edges

Source

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

Uniform physical edges.

Source

pub fn resolved(&self, dir: LayoutDirection) -> Self

Resolve logical overrides onto the physical sides under dir. Returns a fresh Edges whose left / right / top / bottom are the values the layout backend should use; the Option fields are cleared so a second call is idempotent.

  • inline_start writes left (LTR) or right (RTL).
  • inline_end writes right (LTR) or left (RTL).
  • block_start writes top; block_end writes bottom.
  • LayoutDirection::Auto is treated as LTR (the cascade resolver should have stamped a concrete direction before this is reached; the fallback keeps this fn total).

Trait Implementations§

Source§

impl Clone for Edges

Source§

fn clone(&self) -> Edges

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 Debug for Edges

Source§

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

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

impl Default for Edges

Source§

fn default() -> Edges

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

impl PartialEq for Edges

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 Edges

Auto Trait Implementations§

§

impl Freeze for Edges

§

impl RefUnwindSafe for Edges

§

impl Send for Edges

§

impl Sync for Edges

§

impl Unpin for Edges

§

impl UnsafeUnpin for Edges

§

impl UnwindSafe for Edges

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.

§

impl<T> FromTemplate for T
where T: Clone + Default + Unpin,

§

type Template = T

The Template for this type.
§

impl<T> FromWorld for T
where T: Default,

§

fn from_world(_world: &mut World) -> T

Creates Self using default().

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.

§

impl<T> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
§

impl<T> Template for T
where T: Clone + Default + Unpin,

§

type Output = T

The type of value produced by this Template.
§

fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>

Uses this template and the given entity context to produce a Template::Output.
§

fn clone_template(&self) -> T

Clones this template. See Clone.
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.
§

impl<T> ConditionalSend for T
where T: Send,