Struct TwoWayBinding
pub struct TwoWayBinding(/* private fields */);Expand description
Two-way binding causes changes to either the source value or the target value to automatically update the other.
In a two-way binding the binding from the source to target works the same way as in a Binding. When the source
value is modified, the value is written to the BindingTargetRuntime of the TwoWayBinding.
When anything other than the binding itself modifies the target value, the value is copied to the source.
The value is copied to the source using set_property to write the property value.
Removing the binding does not erase the value that is written to the source.
Implementations§
§impl TwoWayBinding
impl TwoWayBinding
pub fn create<T>(
source_path: impl AsRef<KanziStr>,
source_property_type: &PropertyType<T>,
source_field: PropertyField,
) -> Result<TwoWayBinding, Error>
pub fn create<T>( source_path: impl AsRef<KanziStr>, source_property_type: &PropertyType<T>, source_field: PropertyField, ) -> Result<TwoWayBinding, Error>
Creates a two-way binding.
§Arguments
source_path- Path to source object.source_property_type- Source property type from which to bind.source_field- Field of the source property type from which to bind. UsePropertyField::Wholeto bind to the whole property.
pub fn create_with_property<T>(
source_path: impl AsRef<KanziStr>,
source_property_type: &PropertyType<T>,
) -> Result<TwoWayBinding, Error>
pub fn create_with_property<T>( source_path: impl AsRef<KanziStr>, source_property_type: &PropertyType<T>, ) -> Result<TwoWayBinding, Error>
Creates a two-way binding.
§Arguments
source_path- Path to source object.source_property_type- Source property type from which to bind.
Methods from Deref<Target = AbstractBinding>§
pub fn as_ptr(&self) -> *mut AbstractBindingWrapper
pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
Gets a pointer to the backing C++ instance.
pub fn add_processor(
&self,
binding_processor: &BindingProcessor,
) -> Result<(), Error>
pub fn add_processor( &self, binding_processor: &BindingProcessor, ) -> Result<(), Error>
Adds binding processor.
pub fn remove_processor(
&self,
binding_processor: &BindingProcessor,
) -> Result<(), Error>
pub fn remove_processor( &self, binding_processor: &BindingProcessor, ) -> Result<(), Error>
Removes binding processor.
Trait Implementations§
§impl Deref for TwoWayBinding
impl Deref for TwoWayBinding
§type Target = AbstractBinding
type Target = AbstractBinding
The resulting type after dereferencing.
§fn deref(&self) -> &<TwoWayBinding as Deref>::Target
fn deref(&self) -> &<TwoWayBinding as Deref>::Target
Dereferences the value.
§impl Inherits<AbstractBinding> for TwoWayBinding
impl Inherits<AbstractBinding> for TwoWayBinding
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
Auto Trait Implementations§
impl Freeze for TwoWayBinding
impl RefUnwindSafe for TwoWayBinding
impl !Send for TwoWayBinding
impl !Sync for TwoWayBinding
impl Unpin for TwoWayBinding
impl UnwindSafe for TwoWayBinding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more