Skip to main content

UnifiedConstraints

Struct UnifiedConstraints 

Source
pub struct UnifiedConstraints {
Show 24 fields pub shape_boundaries: Vec<ShapeBoundary>, pub shape_exclusions: Vec<ShapeBoundary>, pub available_width: AvailableSpace, pub available_height: Option<f32>, pub writing_mode: Option<WritingMode>, pub direction: Option<BidiDirection>, pub text_orientation: TextOrientation, pub text_align: TextAlign, pub text_justify: JustifyContent, pub line_height: f32, pub vertical_align: VerticalAlign, pub overflow: OverflowBehavior, pub segment_alignment: SegmentAlignment, pub text_combine_upright: Option<TextCombineUpright>, pub exclusion_margin: f32, pub hyphenation: bool, pub hyphenation_language: Option<Language>, pub text_indent: f32, pub initial_letter: Option<InitialLetter>, pub line_clamp: Option<NonZeroUsize>, pub text_wrap: TextWrap, pub columns: u32, pub column_gap: f32, pub hanging_punctuation: bool,
}
Expand description

Unified constraints combining all layout features

§CSS Inline Layout Module Level 3: Constraint Mapping

This structure maps CSS properties to layout constraints:

§\u00a7 2.1 Layout of Line Boxes

  • available_width: \u26a0\ufe0f CRITICAL - Should equal containing block’s inner width
    • Currently defaults to 0.0 which causes immediate line breaking
    • Per spec: “logical width of a line box is equal to the inner logical width of its containing block”
  • available_height: For block-axis constraints (max-height)

§\u00a7 2.2 Layout Within Line Boxes

  • text_align: \u2705 Horizontal alignment (start, end, center, justify)
  • vertical_align: \u26a0\ufe0f PARTIAL - Only baseline supported, missing:
    • top, bottom, middle, text-top, text-bottom
    • , values
    • sub, super positions
  • line_height: \u2705 Distance between baselines

§\u00a7 3 Baselines and Alignment Metrics

  • text_orientation: \u2705 For vertical writing (sideways, upright)
  • writing_mode: \u2705 horizontal-tb, vertical-rl, vertical-lr
  • direction: \u2705 ltr, rtl for BiDi

§\u00a7 4 Baseline Alignment (vertical-align property)

\u26a0\ufe0f INCOMPLETE: Only basic baseline alignment implemented

§\u00a7 5 Line Spacing (line-height property)

  • line_height: \u2705 Implemented
  • \u274c MISSING: line-fit-edge for controlling which edges contribute to line height

§\u00a7 6 Trimming Leading (text-box-trim)

  • \u274c NOT IMPLEMENTED: text-box-trim property
  • \u274c NOT IMPLEMENTED: text-box-edge property

§CSS Text Module Level 3

  • text_indent: \u2705 First line indentation
  • text_justify: \u2705 Justification algorithm (auto, inter-word, inter-character)
  • hyphenation: \u2705 Automatic hyphenation
  • hanging_punctuation: \u2705 Hanging punctuation at line edges

§CSS Text Level 4

  • text_wrap: \u2705 balance, pretty, stable
  • line_clamp: \u2705 Max number of lines

§CSS Writing Modes Level 4

  • text_combine_upright: \u2705 Tate-chu-yoko for vertical text

§CSS Shapes Module

  • shape_boundaries: \u2705 Custom line box shapes
  • shape_exclusions: \u2705 Exclusion areas (float-like behavior)
  • exclusion_margin: \u2705 Margin around exclusions

§Multi-column Layout

  • columns: \u2705 Number of columns
  • column_gap: \u2705 Gap between columns

§Known Issues:

  1. [ISSUE] available_width defaults to Definite(0.0) instead of containing block width
  2. [ISSUE] vertical_align only supports baseline
  3. [TODO] initial-letter (drop caps) not implemented

Fields§

§shape_boundaries: Vec<ShapeBoundary>§shape_exclusions: Vec<ShapeBoundary>§available_width: AvailableSpace§available_height: Option<f32>§writing_mode: Option<WritingMode>§direction: Option<BidiDirection>§text_orientation: TextOrientation§text_align: TextAlign§text_justify: JustifyContent§line_height: f32§vertical_align: VerticalAlign§overflow: OverflowBehavior§segment_alignment: SegmentAlignment§text_combine_upright: Option<TextCombineUpright>§exclusion_margin: f32§hyphenation: bool§hyphenation_language: Option<Language>§text_indent: f32§initial_letter: Option<InitialLetter>§line_clamp: Option<NonZeroUsize>§text_wrap: TextWrap§columns: u32§column_gap: f32§hanging_punctuation: bool

Trait Implementations§

Source§

impl Clone for UnifiedConstraints

Source§

fn clone(&self) -> UnifiedConstraints

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 UnifiedConstraints

Source§

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

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

impl Default for UnifiedConstraints

Source§

fn default() -> Self

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

impl Hash for UnifiedConstraints

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for UnifiedConstraints

Source§

fn eq(&self, other: &Self) -> 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 Eq for UnifiedConstraints

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GetHash for T
where T: Hash,

Source§

fn get_hash(&self) -> u64

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool