pub struct Runtime { /* private fields */ }Expand description
Reactive renderer: mounts a root view, diffs trees, and collects Patches.
run owns a Runtime for you. Use this type directly only in tests or
custom hosts that call flush_effects and apply patches themselves.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn mount(&mut self, f: impl Fn(&Cx) -> Element + 'static)
pub fn mount(&mut self, f: impl Fn(&Cx) -> Element + 'static)
Mounts a single root view function (same shape as the closure passed to run).
Sourcepub fn flush_effects(&mut self)
pub fn flush_effects(&mut self)
Re-runs dirty views, diffs against the previous tree, and queues patches.
Call after changing a Signal (or other tracked state), then take_patches.
Sourcepub fn take_patches(&mut self) -> Vec<Patch>
pub fn take_patches(&mut self) -> Vec<Patch>
Returns and clears patches produced since the last take_patches.
Sourcepub fn flush_deferred_effects(&mut self)
pub fn flush_deferred_effects(&mut self)
Run mount-time use_effect hooks queued during render (after first paint).
Sourcepub fn root_element(&self) -> Option<Element>
pub fn root_element(&self) -> Option<Element>
Frozen element tree after the last successful render (for RetainedTree::mount).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Runtime
impl !RefUnwindSafe for Runtime
impl !Send for Runtime
impl !Sync for Runtime
impl Unpin for Runtime
impl UnsafeUnpin for Runtime
impl !UnwindSafe for Runtime
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
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.