pub struct Binding<T: 'static> {
pub read: ReadSignal<T>,
/* private fields */
}Expand description
A reactive, two-way binding to one field-shaped value.
Equality compares the binding’s producer-defined identity. Equal bindings are guaranteed to represent the same read and write behavior; producers may conservatively return unequal bindings when they cannot prove that interchangeability.
Fields§
§read: ReadSignal<T>The binding’s reactive value.
Implementations§
Source§impl<T: 'static> Binding<T>
impl<T: 'static> Binding<T>
Sourcepub fn new(
read: ReadSignal<T>,
write: Callback<(T, ChangeOrigin)>,
commit: Callback<()>,
) -> Self
pub fn new( read: ReadSignal<T>, write: Callback<(T, ChangeOrigin)>, commit: Callback<()>, ) -> Self
Creates a binding identified by its exact read, write, and commit handles.
Sourcepub fn new_with_identity<I>(
read: ReadSignal<T>,
write: Callback<(T, ChangeOrigin)>,
commit: Callback<()>,
identity: I,
) -> Selfwhere
I: PartialEq + 'static,
pub fn new_with_identity<I>(
read: ReadSignal<T>,
write: Callback<(T, ChangeOrigin)>,
commit: Callback<()>,
identity: I,
) -> Selfwhere
I: PartialEq + 'static,
Creates a binding with a producer-defined comparable identity.
Equal identities must always represent interchangeable read, write, and commit behavior.
Producers that cannot prove interchangeability should use Binding::new instead.
Sourcepub fn write(&self, value: T, origin: ChangeOrigin)
pub fn write(&self, value: T, origin: ChangeOrigin)
Writes a value and preserves where the change originated.
Sourcepub fn into_trio(self) -> BindingPropTrio<T>
pub fn into_trio(self) -> BindingPropTrio<T>
Decomposes this binding into the dependency-free widget prop contract.
The lower-level on_change callback has no origin parameter, so its writes are user writes.