Skip to main content

Binding

Struct Binding 

Source
pub struct Binding { /* private fields */ }
Expand description

A binding with a string path, resolved at run time. This is the binding that markup creates when bindings are not compiled.

The class derives from ReflectionBinding, whose properties it has. Like it, a binding is a mutable reference object shared as Rc<Binding>, which converts to Rc<dyn BindingBase>; handles compare by identity.

Implementations§

Source§

impl Binding

Source

pub fn new() -> Rc<Self>

Creates a binding without a path: binds to the source itself.

Source

pub fn with_path(path: &str) -> Rc<Self>

Creates a binding with the given path.

Source

pub fn with_path_and_mode(path: &str, mode: BindingMode) -> Rc<Self>

Creates a binding with the given path and mode.

Source

pub fn with_converter( self: Rc<Self>, converter: Rc<dyn IValueConverter>, ) -> Rc<Self>

The chaining form of set_converter, for a converter.

Source§

impl Binding

Source

pub fn with_converter_value( self: Rc<Self>, value: Option<Rc<dyn IValueConverter>>, ) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_converter_culture( self: Rc<Self>, value: Option<CultureInfo>, ) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_converter_parameter( self: Rc<Self>, value: Option<BoxedValue>, ) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_delay(self: Rc<Self>, value: i32) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_element_name(self: Rc<Self>, value: Option<String>) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_fallback_value( self: Rc<Self>, value: Option<BoxedValue>, ) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_mode(self: Rc<Self>, value: BindingMode) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_priority(self: Rc<Self>, value: BindingPriority) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_relative_source( self: Rc<Self>, value: Option<Rc<RelativeSource>>, ) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_source(self: Rc<Self>, value: Option<BoxedValue>) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_string_format(self: Rc<Self>, value: Option<String>) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_target_null_value( self: Rc<Self>, value: Option<BoxedValue>, ) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_update_source_trigger( self: Rc<Self>, value: UpdateSourceTrigger, ) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_type_resolver( self: Rc<Self>, value: Option<TypeResolver>, ) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_default_anchor( self: Rc<Self>, value: Option<WeakRef<FerroObject>>, ) -> Rc<Self>

The chaining form of the setter.

Source

pub fn with_name_scope( self: Rc<Self>, value: Option<Weak<dyn INameScope>>, ) -> Rc<Self>

The chaining form of the setter.

Methods from Deref<Target = ReflectionBinding>§

Source

pub fn converter(&self) -> Option<Rc<dyn IValueConverter>>

The converter to use.

Source

pub fn set_converter(&self, value: Option<Rc<dyn IValueConverter>>)

Source

pub fn with_converter_value( self: Rc<ReflectionBinding>, value: Option<Rc<dyn IValueConverter>>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn converter_culture(&self) -> Option<CultureInfo>

The culture in which to evaluate the converter. None (the default) uses the current culture.

Source

pub fn set_converter_culture(&self, value: Option<CultureInfo>)

Source

pub fn with_converter_culture( self: Rc<ReflectionBinding>, value: Option<CultureInfo>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn converter_parameter(&self) -> Option<Rc<dyn AnyValue>>

A parameter to pass to the converter.

Source

pub fn set_converter_parameter(&self, value: Option<Rc<dyn AnyValue>>)

Source

pub fn with_converter_parameter( self: Rc<ReflectionBinding>, value: Option<Rc<dyn AnyValue>>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn delay(&self) -> i32

The amount of time, in milliseconds, to wait before updating the binding source after the value on the target changes.

Source

pub fn set_delay(&self, value: i32)

Source

pub fn with_delay( self: Rc<ReflectionBinding>, value: i32, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn element_name(&self) -> Option<String>

The name of the element to use as the binding source.

Source

pub fn set_element_name(&self, value: Option<String>)

Source

pub fn with_element_name( self: Rc<ReflectionBinding>, value: Option<String>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn fallback_value(&self) -> Option<Rc<dyn AnyValue>>

The value to use when the binding is unable to produce a value; the unset marker for none.

Source

pub fn set_fallback_value(&self, value: Option<Rc<dyn AnyValue>>)

Source

pub fn with_fallback_value( self: Rc<ReflectionBinding>, value: Option<Rc<dyn AnyValue>>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn mode(&self) -> BindingMode

The binding mode.

Source

pub fn set_mode(&self, value: BindingMode)

Source

pub fn with_mode( self: Rc<ReflectionBinding>, value: BindingMode, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn path(&self) -> String

The binding path.

Source

pub fn set_path(&self, value: String)

Source

pub fn with_path( self: Rc<ReflectionBinding>, value: String, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn priority(&self) -> BindingPriority

The binding priority.

Source

pub fn set_priority(&self, value: BindingPriority)

Source

pub fn with_priority( self: Rc<ReflectionBinding>, value: BindingPriority, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn relative_source(&self) -> Option<Rc<RelativeSource>>

The relative source for the binding.

Source

pub fn set_relative_source(&self, value: Option<Rc<RelativeSource>>)

Source

pub fn with_relative_source( self: Rc<ReflectionBinding>, value: Option<Rc<RelativeSource>>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn source(&self) -> Option<Rc<dyn AnyValue>>

The source for the binding; the unset marker (the default) for none.

Source

pub fn set_source(&self, value: Option<Rc<dyn AnyValue>>)

Source

pub fn with_source( self: Rc<ReflectionBinding>, value: Option<Rc<dyn AnyValue>>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn string_format(&self) -> Option<String>

The string format.

Source

pub fn set_string_format(&self, value: Option<String>)

Source

pub fn with_string_format( self: Rc<ReflectionBinding>, value: Option<String>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn target_null_value(&self) -> Option<Rc<dyn AnyValue>>

The value to use when the binding produces null; the unset marker for none.

Source

pub fn set_target_null_value(&self, value: Option<Rc<dyn AnyValue>>)

Source

pub fn with_target_null_value( self: Rc<ReflectionBinding>, value: Option<Rc<dyn AnyValue>>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn update_source_trigger(&self) -> UpdateSourceTrigger

What triggers updates of the binding source in two-way and one-way-to-source bindings.

Source

pub fn set_update_source_trigger(&self, value: UpdateSourceTrigger)

Source

pub fn with_update_source_trigger( self: Rc<ReflectionBinding>, value: UpdateSourceTrigger, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn type_resolver( &self, ) -> Option<Rc<dyn Fn(Option<&str>, &str) -> Option<CastTarget>>>

Resolves the type names in the path (casts, attached properties, ancestor types).

Source

pub fn set_type_resolver( &self, value: Option<Rc<dyn Fn(Option<&str>, &str) -> Option<CastTarget>>>, )

Source

pub fn with_type_resolver( self: Rc<ReflectionBinding>, value: Option<Rc<dyn Fn(Option<&str>, &str) -> Option<CastTarget>>>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn default_anchor(&self) -> Option<WeakRef<FerroObject>>

The anchor to use if the target is not an element.

Source

pub fn set_default_anchor(&self, value: Option<WeakRef<FerroObject>>)

Source

pub fn with_default_anchor( self: Rc<ReflectionBinding>, value: Option<WeakRef<FerroObject>>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn name_scope(&self) -> Option<Weak<dyn INameScope>>

The name scope in which named elements are looked up.

Source

pub fn set_name_scope(&self, value: Option<Weak<dyn INameScope>>)

Source

pub fn with_name_scope( self: Rc<ReflectionBinding>, value: Option<Weak<dyn INameScope>>, ) -> Rc<ReflectionBinding>

The chaining form of the setter.

Source

pub fn with_converter( self: Rc<ReflectionBinding>, converter: Rc<dyn IValueConverter>, ) -> Rc<ReflectionBinding>

The chaining form of set_converter, for a converter.

Source

pub fn try_create_instance( &self, target: &FerroObject, target_property: Option<&'static FerroProperty>, anchor: Option<&Ref<FerroObject>>, ) -> Result<Rc<BindingExpression>, ExpressionParseException>

Instantiates the binding, reporting a malformed path as an error instead of panicking.

Trait Implementations§

Source§

impl BindingBase for Binding

Source§

fn create_instance( &self, target: &FerroObject, target_property: Option<&'static FerroProperty>, anchor: Option<&Ref<FerroObject>>, ) -> Rc<dyn BindingExpressionBase>

Creates a binding expression from the binding. Read more
Source§

fn as_any(&self) -> Option<&(dyn Any + 'static)>

The implementing value, for casting to its concrete type (as_any()?.downcast_ref::<T>()): the equivalent of is/as on the contract. None for an implementation that does not expose itself.
Source§

impl Default for Binding

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Deref for Binding

Source§

type Target = ReflectionBinding

The resulting type after dereferencing.
Source§

fn deref(&self) -> &ReflectionBinding

Dereferences the value.
Source§

impl PartialEq for Binding

Compares by identity (reference equality), as the reference type this mirrors.

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.