Skip to main content

Composition

Struct Composition 

Source
pub struct Composition<A: Applier + 'static> { /* private fields */ }

Implementations§

Source§

impl<A: Applier + 'static> Composition<A>

Source

pub fn new(applier: A) -> Self

Source

pub fn with_runtime(applier: A, runtime: Runtime) -> Self

Source

pub fn root_key(&self) -> Option<Key>

Returns the root group key captured from the most recent render() call, or None before the first render.

Source

pub fn set_retention_policy(&self, policy: RetentionPolicy)

Source

pub fn take_root_render_request(&mut self) -> bool

Source

pub fn render( &mut self, key: Key, content: impl FnMut(), ) -> Result<(), NodeError>

Source

pub fn render_stable( &mut self, key: Key, content: impl FnMut(), ) -> Result<(), NodeError>

Perform a root render and continue replaying any resulting root-render requests until the composition reaches a stable fixpoint.

Source

pub fn reconcile( &mut self, key: Key, content: impl FnMut(), ) -> Result<bool, NodeError>

Process invalid scopes and any resulting root-render requests until the composition reaches a stable fixpoint for the supplied root content.

Source

pub fn should_render(&self) -> bool

Returns true if composition needs to process invalid scopes (recompose).

This checks both:

  • has_updates(): composition scopes that were invalidated by state changes
  • needs_frame(): animation callbacks that may have pending work

Note: For scroll performance, ensure scroll state changes use Cell instead of MutableState to avoid triggering recomposition on every scroll frame.

Source

pub fn runtime_handle(&self) -> RuntimeHandle

Source

pub fn applier_mut(&mut self) -> ApplierGuard<'_, A>

Source

pub fn root(&self) -> Option<NodeId>

Source

pub fn debug_dump_slot_table_groups( &self, ) -> Vec<(usize, Key, Option<usize>, usize)>

Source

pub fn debug_dump_slot_entries(&self) -> Vec<SlotDebugEntry>

Source

pub fn slot_table_heap_bytes(&self) -> usize

Source

pub fn debug_slot_table_stats(&self) -> SlotTableDebugStats

Source

pub fn debug_slot_snapshot(&self) -> SlotDebugSnapshot

Source

pub fn debug_observer_stats(&self) -> SnapshotStateObserverDebugStats

Source

pub fn debug_last_pass_stats(&self) -> CompositionPassDebugStats

Source

pub fn process_invalid_scopes(&mut self) -> Result<bool, NodeError>

Source

pub fn flush_pending_node_updates(&mut self) -> Result<(), NodeError>

Trait Implementations§

Source§

impl<A: Applier + 'static> Drop for Composition<A>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<A> Freeze for Composition<A>

§

impl<A> !RefUnwindSafe for Composition<A>

§

impl<A> !Send for Composition<A>

§

impl<A> !Sync for Composition<A>

§

impl<A> Unpin for Composition<A>

§

impl<A> UnsafeUnpin for Composition<A>

§

impl<A> !UnwindSafe for Composition<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, 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.