pub struct FieldContext { /* private fields */ }Expand description
Type-erased context for one field’s binding, metadata, and focus request slot.
The context itself is intentionally not generic. This lets use_binding distinguish an
absent context from a present context containing the wrong value type, and lets Field
accept any value type without becoming generic itself.
§Equality
Two contexts are equal when their bindings are equal under Binding’s identity equality and
their metadata is equal, regardless of when either context was constructed. The focus request
slot is intentionally excluded: Field pins the slot of the first context it receives for
its lifetime, so the slot carried by a context built on a later render is never observed by
descendants, and comparing it would only defeat memoization.
Implementations§
Source§impl FieldContext
impl FieldContext
Sourcepub fn with_binding<T: 'static>(self, binding: Binding<T>) -> Self
pub fn with_binding<T: 'static>(self, binding: Binding<T>) -> Self
Replaces the context’s value binding.
Sourcepub fn with_meta_values(self, values: FieldMetaValues) -> Self
pub fn with_meta_values(self, values: FieldMetaValues) -> Self
Adds producer values that Field realizes as signal-backed metadata.
Sourcepub fn focus_request(&self) -> FocusRequest
pub fn focus_request(&self) -> FocusRequest
Returns the context’s focus request slot.
Field pins the slot of the first context it receives, so producers that request focus
through a context must keep that context stable across renders.
Trait Implementations§
Source§impl Clone for FieldContext
impl Clone for FieldContext
Source§fn clone(&self) -> FieldContext
fn clone(&self) -> FieldContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more