pub trait Render {
// Required methods
fn capabilities(&self) -> Capabilities;
fn apply(&mut self, mutations: &[Mutation]) -> Result<Receipt, Error>;
fn request(&mut self, query: Query, token: QueryToken) -> Result<(), Error>;
fn drain(&mut self, inputs: &mut Vec<Input>);
// Provided methods
fn flush_display(&mut self) -> Result<(), Error> { ... }
fn preflight(
&self,
_node: DescriptorView<'_>,
_patch: Option<&Patch>,
) -> Result<(), Error> { ... }
fn preflight_place(
&self,
_tree: &Memory,
_child: Subtree<'_>,
_parent: Option<NodeId>,
) -> Result<(), Error> { ... }
fn set_profile(&mut self, profile: Option<Profile>) -> Option<Profile> { ... }
fn needs_observe(&self) -> bool { ... }
fn style_profile(&self) -> Profile { ... }
fn listen(
&mut self,
_node: NodeId,
_kind: EventKind,
_enabled: bool,
) -> Result<(), Error> { ... }
fn action(&mut self, _action: Action) -> Result<(), Error> { ... }
}Expand description
Local calls are typed and require no serialization. Each request observes every preceding successful apply; adapters must not coalesce across requests. A response carries the watermark at request acceptance, even if delivered after later commits. Capture results at that barrier, not from a newer tree. Errors may leave an applied prefix; adapters do not promise rollback.
Required Methods§
fn capabilities(&self) -> Capabilities
fn apply(&mut self, mutations: &[Mutation]) -> Result<Receipt, Error>
fn request(&mut self, query: Query, token: QueryToken) -> Result<(), Error>
Provided Methods§
Sourcefn flush_display(&mut self) -> Result<(), Error>
fn flush_display(&mut self) -> Result<(), Error>
Commit adapter-owned display slots after semantic mutations and before actions/queries. This does not allocate semantic element identities.
Sourcefn preflight(
&self,
_node: DescriptorView<'_>,
_patch: Option<&Patch>,
) -> Result<(), Error>
fn preflight( &self, _node: DescriptorView<'_>, _patch: Option<&Patch>, ) -> Result<(), Error>
Reject descriptor-local limitations before the App changes its logical tree or queues output. None checks creation; Some checks a patch against the supplied current descriptor, including earlier uncommitted changes. Read only these arguments and immutable adapter configuration: no host calls, layout, application callbacks, or committed-tree lookups. Adapters must enforce the same restrictions in apply for callers without an App. This is not a transaction or a guarantee that later host work succeeds.
Sourcefn preflight_place(
&self,
_tree: &Memory,
_child: Subtree<'_>,
_parent: Option<NodeId>,
) -> Result<(), Error>
fn preflight_place( &self, _tree: &Memory, _child: Subtree<'_>, _parent: Option<NodeId>, ) -> Result<(), Error>
Validate adapter-specific ancestor/content constraints against the App’s staged semantic tree, including uncommitted Create/Patch/Place changes. New children are checked before identity allocation; existing children before Place/Resume changes the model or output queue. Read only these arguments/configuration: no host tree, layout, I/O or application code. The App checks shared identity/placement semantics first. Default adds no restrictions. Direct apply must enforce the same content rules.
Sourcefn set_profile(&mut self, profile: Option<Profile>) -> Option<Profile>
fn set_profile(&mut self, profile: Option<Profile>) -> Option<Profile>
Optional local diagnostics. Return an unused or retired handle so its captured clock is dropped outside the caller’s renderer borrow.
Sourcefn needs_observe(&self) -> bool
fn needs_observe(&self) -> bool
Another local observation can make progress without awaiting I/O, an animation timestamp or a future browser frame. Read-only and never runs application code. Hosts with asynchronous observation keep the default.
Sourcefn style_profile(&self) -> Profile
fn style_profile(&self) -> Profile
Declared once per App. Default rejects nonempty inline styles; adapters opt into exactly the declarations/values they preserve or implement.
Sourcefn listen(
&mut self,
_node: NodeId,
_kind: EventKind,
_enabled: bool,
) -> Result<(), Error>
fn listen( &mut self, _node: NodeId, _kind: EventKind, _enabled: bool, ) -> Result<(), Error>
Event interest is frame metadata. Hosts may use it to avoid observing thousands of nodes whose resize/scroll events nobody consumes.
Sourcefn action(&mut self, _action: Action) -> Result<(), Error>
fn action(&mut self, _action: Action) -> Result<(), Error>
Actions run after a frame’s mutations and before subsequent queries. Unsupported focus refusal leaves the semantic tree valid: App treats it as an unfulfilled intent and continues later intents. Backend errors remain fatal. Never synthesize FocusChanged(true) merely for accepting Focus.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".