pub enum LayoutDecision {
#[non_exhaustive] PriorityDrop {
id: Cow<'static, str>,
priority: u8,
terminal_width: u16,
overflow: u32,
dropped_width: u16,
},
#[non_exhaustive] ShrinkApplied {
id: Cow<'static, str>,
from: u16,
to: u16,
target: u16,
},
#[non_exhaustive] ReflowApplied {
id: Cow<'static, str>,
from: u16,
to: u16,
target: u16,
},
#[non_exhaustive] WidthBoundUnderMinDrop {
id: Cow<'static, str>,
rendered_width: u16,
min: u16,
},
#[non_exhaustive] WidthBoundOverMaxTruncate {
id: Cow<'static, str>,
rendered_width: u16,
max: u16,
},
}Expand description
Event emitted by the layout engine when it takes one of five
decisions under width pressure. The id field on every variant
is borrowed from [crate::segments::LineItem::Segment.id] (per
ADR-0026); built-in segment ids carry as Cow::Borrowed so the
production path stays allocation-free.
Engine emit sites use the pub(crate) constructors below to pick
up the debug_assert!’d width-relation invariants for free.
Variants§
#[non_exhaustive]PriorityDrop
The reflow loop dropped a segment outright (no shrink form
via try_shrink, no truncatable end-ellipsis feasible via
try_reflow, or simply not truncatable). Fires whenever
the engine removes a segment under width pressure.
Fields
This variant is marked as non-exhaustive
priority: u8Engine defaults().priority at drop time. > 0
(priority-0 is pinned per highest_priority_droppable).
terminal_width: u16Terminal cell budget at the call site
(apply_layout’s terminal_width parameter).
#[non_exhaustive]ShrinkApplied
try_shrink returned a valid compact render. from is the
pre-shrink width, to is the post-shrink width, target is
the width the reflow loop asked the segment to fit under.
Invariant: to <= target < from.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]ReflowApplied
try_reflow succeeded with an end-ellipsis on a truncatable
segment. Same from/to/target shape as ShrinkApplied.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]WidthBoundUnderMinDrop
apply_width_bounds returned None because the rendered
width fell below the configured width.min — the segment is
hidden rather than displayed at a wrong width.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]WidthBoundOverMaxTruncate
apply_width_bounds clipped a too-wide render via
truncate_to (end-ellipsis) because rendered_width > max.
Emitted at the apply_width_bounds call site, NOT inside
truncate_to itself (which is also reached from try_reflow,
where the emit is ReflowApplied).
Implementations§
Source§impl LayoutDecision
impl LayoutDecision
Sourcepub fn remediation(&self) -> Option<&'static str>
pub fn remediation(&self) -> Option<&'static str>
Engine-recommended remediation phrasing for the decision, or
None when the decision doesn’t have a user-actionable fix.
Returns &'static str because every remediation is a literal;
reach for format! and the signature stops compiling, which
keeps the table in one place and testable.
Per-variant match (no _ arm) so a future sixth variant
forces the author to declare its remediation intent at
compile time rather than silently inheriting None.
Trait Implementations§
Source§impl Clone for LayoutDecision
impl Clone for LayoutDecision
Source§fn clone(&self) -> LayoutDecision
fn clone(&self) -> LayoutDecision
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LayoutDecision
impl Debug for LayoutDecision
Source§impl PartialEq for LayoutDecision
impl PartialEq for LayoutDecision
Source§fn eq(&self, other: &LayoutDecision) -> bool
fn eq(&self, other: &LayoutDecision) -> bool
self and other values to be equal, and is used by ==.impl Eq for LayoutDecision
impl StructuralPartialEq for LayoutDecision
Auto Trait Implementations§
impl Freeze for LayoutDecision
impl RefUnwindSafe for LayoutDecision
impl Send for LayoutDecision
impl Sync for LayoutDecision
impl Unpin for LayoutDecision
impl UnsafeUnpin for LayoutDecision
impl UnwindSafe for LayoutDecision
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.