pub trait UiWriter<H: UiHost> {
// Required methods
fn with_cx_mut<R>(
&mut self,
f: impl FnOnce(&mut ElementContext<'_, H>) -> R,
) -> R;
fn add(&mut self, element: AnyElement);
// Provided methods
fn extend<I>(&mut self, elements: I)
where I: IntoIterator<Item = AnyElement> { ... }
fn mount<I>(&mut self, f: impl FnOnce(&mut ElementContext<'_, H>) -> I)
where I: IntoIterator<Item = AnyElement> { ... }
fn keyed<K: Hash, R>(
&mut self,
key: K,
f: impl FnOnce(&mut ElementContext<'_, H>) -> R,
) -> R { ... }
}Expand description
Minimal authoring surface for immediate-style composition.
This is intended for ecosystem crates that want to expose helpers that work across multiple authoring frontends while staying policy-light.
Required Methods§
Sourcefn with_cx_mut<R>(
&mut self,
f: impl FnOnce(&mut ElementContext<'_, H>) -> R,
) -> R
fn with_cx_mut<R>( &mut self, f: impl FnOnce(&mut ElementContext<'_, H>) -> R, ) -> R
Execute a closure with access to the underlying element context (escape hatch).
This avoids leaking ElementContext’s lifetime parameter through the trait surface while
still enabling advanced integrations when needed.
Sourcefn add(&mut self, element: AnyElement)
fn add(&mut self, element: AnyElement)
Append a single element to the current output list.
Provided Methods§
Sourcefn extend<I>(&mut self, elements: I)where
I: IntoIterator<Item = AnyElement>,
fn extend<I>(&mut self, elements: I)where
I: IntoIterator<Item = AnyElement>,
Append an iterator of elements to the current output list.
Sourcefn mount<I>(&mut self, f: impl FnOnce(&mut ElementContext<'_, H>) -> I)where
I: IntoIterator<Item = AnyElement>,
fn mount<I>(&mut self, f: impl FnOnce(&mut ElementContext<'_, H>) -> I)where
I: IntoIterator<Item = AnyElement>,
Embed an existing declarative builder into the current output list.
Sourcefn keyed<K: Hash, R>(
&mut self,
key: K,
f: impl FnOnce(&mut ElementContext<'_, H>) -> R,
) -> R
fn keyed<K: Hash, R>( &mut self, key: K, f: impl FnOnce(&mut ElementContext<'_, H>) -> R, ) -> R
Create a keyed identity scope.
This delegates to the runtime’s canonical keyed identity mechanism (ElementContext::keyed)
so hashing and stable ID rules remain consistent across frontends.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".