pub struct Recomposer { /* private fields */ }Expand description
The slot table runtime for one root: what composes the tree and runs its handlers.
Every method enters the composition for its own length, so it may be called from any
Host call on the UI thread. The tree’s records go into [Recomposer::writer]’s batch,
between whatever the Host writes before and after them.
Implementations§
Source§impl Recomposer
impl Recomposer
Sourcepub fn new(content: impl Fn() + 'static) -> Self
pub fn new(content: impl Fn() + 'static) -> Self
A runtime for content, composed by Recomposer::rebuild.
Sourcepub fn size_token(&self, node_id: u32) -> Option<u32>
pub fn size_token(&self, node_id: u32) -> Option<u32>
The application’s name for a node it asked to have measured, if it asked.
Sourcepub fn render(&mut self, frame_time_nanos: Option<u64>)
pub fn render(&mut self, frame_time_nanos: Option<u64>)
Writes whatever changed since the last call: a frame’s time to whatever waits for one, the futures that woke, and the scopes the states written since invalidated.
Sourcepub fn handle_event(
&mut self,
event: &HostEvent<'_>,
) -> Result<i64, ProtocolError>
pub fn handle_event( &mut self, event: &HostEvent<'_>, ) -> Result<i64, ProtocolError>
Runs the handler an event names, and nothing else; the caller renders afterwards.
Returns what the boundary hands back as the call’s result, which is how a key handler says it consumed the key. An event naming a handler or node this composition does not have is an error, and so is a payload no handler can take.
Sourcepub fn run_in_context(&mut self, action: &mut dyn FnMut())
pub fn run_in_context(&mut self, action: &mut dyn FnMut())
Runs code the application handed to the Host, a message’s action for one, with this composition current, so the states it writes are picked up by the next render.