pub trait ModifierNodeElement:
Debug
+ Hash
+ PartialEq
+ 'static {
type Node: ModifierNode;
// Required methods
fn create(&self) -> Self::Node;
fn update(&self, node: &mut Self::Node);
// Provided methods
fn key(&self) -> Option<u64> { ... }
fn inspector_name(&self) -> &'static str { ... }
fn inspector_properties(
&self,
_inspector: &mut dyn FnMut(&'static str, String),
) { ... }
fn capabilities(&self) -> NodeCapabilities { ... }
fn always_update(&self) -> bool { ... }
}Expand description
Strongly typed modifier elements that can create and update nodes while exposing equality/hash/inspector contracts that mirror Jetpack Compose.
Required Associated Types§
type Node: ModifierNode
Required Methods§
Provided Methods§
Sourcefn key(&self) -> Option<u64>
fn key(&self) -> Option<u64>
Optional key used to disambiguate multiple instances of the same element type.
Sourcefn inspector_name(&self) -> &'static str
fn inspector_name(&self) -> &'static str
Human readable name surfaced to inspector tooling.
Sourcefn inspector_properties(&self, _inspector: &mut dyn FnMut(&'static str, String))
fn inspector_properties(&self, _inspector: &mut dyn FnMut(&'static str, String))
Records inspector properties for tooling.
Sourcefn capabilities(&self) -> NodeCapabilities
fn capabilities(&self) -> NodeCapabilities
Returns the capabilities of nodes created by this element. Override this to indicate which specialized traits the node implements.
Sourcefn always_update(&self) -> bool
fn always_update(&self) -> bool
Whether this element requires update to be called even if eq returns true.
This is useful for elements that ignore certain fields in eq (e.g. closures)
to allow node reuse, but still need those fields updated in the existing node.
Defaults to false.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.