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 { ... }
fn auto_invalidate_on_update(&self) -> bool { ... }
fn update_invalidation_kind(&self) -> Option<InvalidationKind> { ... }
}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.
Sourcefn auto_invalidate_on_update(&self) -> bool
fn auto_invalidate_on_update(&self) -> bool
Whether modifier reconciliation should request capability-wide invalidations after updating an existing node.
Sourcefn update_invalidation_kind(&self) -> Option<InvalidationKind>
fn update_invalidation_kind(&self) -> Option<InvalidationKind>
Optional targeted invalidation requested after updating an existing node.
This is for nodes whose attach/remove capability is broader than the work needed for a value-only update. For example, an offset node participates in layout on attach but an x/y change only needs placement data and draw output refreshed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".