Skip to main content

LayoutObservers

Struct LayoutObservers 

Source
pub struct LayoutObservers<'a> { /* private fields */ }
Expand description

Two-channel observer the layout engine threads through every render entry point per ADR-0026. warn is required (the engine uses it for segment-render error diagnostics); on_decision is optional and receives a typed LayoutDecision per emit site.

The TUI live preview attaches on_decision to collect per-frame status; the production stdout path doesn’t attach one, so disabled-path cost is one Option::is_none() check per emit site (struct construction is deferred behind Self::emit_with’s closure, so even Cow::Owned user-config ids don’t allocate when no observer is attached).

Single lifetime 'a because Rust unifies independent borrows to their shortest common lifetime — a second lifetime parameter would buy no flexibility for &mut dyn FnMut borrows.

Implementations§

Source§

impl<'a> LayoutObservers<'a>

Source

pub fn new(warn: &'a mut dyn FnMut(&str)) -> Self

Construct with the required warn channel; no observer attached.

Source

pub fn with_decision( self, on_decision: &'a mut dyn FnMut(&LayoutDecision), ) -> Self

Attach an on_decision callback so the engine routes typed LayoutDecision events through it at every emit site. Calling twice replaces the previous callback (last-write-wins).

Auto Trait Implementations§

§

impl<'a> Freeze for LayoutObservers<'a>

§

impl<'a> !RefUnwindSafe for LayoutObservers<'a>

§

impl<'a> !Send for LayoutObservers<'a>

§

impl<'a> !Sync for LayoutObservers<'a>

§

impl<'a> Unpin for LayoutObservers<'a>

§

impl<'a> UnsafeUnpin for LayoutObservers<'a>

§

impl<'a> !UnwindSafe for LayoutObservers<'a>

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

Source§

type Output = T

Should always be Self
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.