Function reconcile_root

Source
pub fn reconcile_root<A: 'static>(
    tree: &mut ElementTree<A>,
    runtime: &RuntimeHandle<A>,
    root_view: View<A>,
) -> ElementId
Expand description

Creates or reconciles the tree root and returns its retained ID.

The first call recursively creates the view. Later calls preserve the root ID and delegate to reconcile_element, irrespective of root kind changes. Component build callbacks run synchronously and may dispatch state changes or panic; mutation is not rolled back on panic.

ยงExamples

use ailloli_ui_runtime::app::RuntimeHandle;
use ailloli_ui_runtime::component::View;
use ailloli_ui_runtime::element::ElementTree;
use ailloli_ui_runtime::element::reconcile::reconcile_root;
let runtime = RuntimeHandle::<()>::new();
let mut tree = ElementTree::new();
let first = reconcile_root(&mut tree, &runtime, View::empty());
let second = reconcile_root(&mut tree, &runtime, View::empty());
assert_eq!(first, second);