Skip to main content

CompiledBindingPathBuilder

Struct CompiledBindingPathBuilder 

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

Builds a CompiledBindingPath.

The builder is a reference object: a shared handle to the elements collected so far. Every method adds an element and returns the builder (another handle to it), so that calls can be chained, as well as made one by one through any clone of the handle. Handles compare by identity.

Implementations§

Source§

impl CompiledBindingPathBuilder

Source

pub fn new() -> Self

Source

pub fn not(&self) -> Self

Negates the result of the path.

Source

pub fn ferro_property(&self, property: &'static FerroProperty) -> Self

A registered property of an object of the class hierarchy.

Source

pub fn ferro_property_with( &self, property: &'static FerroProperty, accepts_null: bool, ) -> Self

A registered property of an object of the class hierarchy. accepts_null applies a null-conditional operator to the access: a null owner produces null instead of an error.

Source

pub fn property( &self, info: Rc<dyn IPropertyInfo>, accessor_factory: PropertyAccessorFactory, ) -> Self

A plain property, from its description and the factory of its accessor.

Source

pub fn property_with( &self, info: Rc<dyn IPropertyInfo>, accessor_factory: PropertyAccessorFactory, accepts_null: bool, ) -> Self

A plain property. accepts_null applies a null-conditional operator to the access: a null owner produces null instead of an error.

Source

pub fn typed_property<S: INotifyPropertyChanged + PartialEq + 'static, V: PropertyValue>( &self, name: &str, get: impl Fn(&S) -> V + 'static, set: Option<Rc<dyn Fn(&S, V)>>, ) -> Self

A property with typed accessors on a model type that raises property change notifications. A binding whose path is this single element, bound to a target property of exactly type V, reads and writes values without boxing them.

Source

pub fn notifying_property<O: INotifyPropertyChanged + PartialEq + 'static, K: PropertyKind>( &self, name: &str, get: impl Fn(&O) -> K::Typed + 'static, set: impl Fn(&O, K::Typed) + 'static, ) -> Self

A read-write property of a model type that raises property change notifications, from typed accessors.

Source

pub fn notifying_read_only_property<O: INotifyPropertyChanged + PartialEq + 'static, K: PropertyKind>( &self, name: &str, get: impl Fn(&O) -> K::Typed + 'static, ) -> Self

A read-only property of a model type that raises property change notifications, from a typed getter.

Source

pub fn command<O: 'static>( &self, method_name: &str, execute: impl Fn(&O, Option<&BoxedValue>) + 'static, can_execute: Option<Rc<dyn Fn(&O, Option<&BoxedValue>) -> bool>>, depends_on_properties: &[&str], ) -> Self

A method used as a command.

Source

pub fn notifying_command<O: INotifyPropertyChanged + 'static>( &self, method_name: &str, execute: impl Fn(&O, Option<&BoxedValue>) + 'static, can_execute: Option<Rc<dyn Fn(&O, Option<&BoxedValue>) -> bool>>, depends_on_properties: &[&str], ) -> Self

A method used as a command on an owner that raises property change notifications: the command’s state is re-queried when one of depends_on_properties changes.

Source

pub fn stream_task(&self) -> Self

Streams the outcome of a task (^).

Source

pub fn stream_observable(&self) -> Self

Streams the values of an observable (^).

Source

pub fn stream(&self, plugin: Rc<dyn IStreamPlugin>) -> Self

Streams values through a custom stream plugin.

Source

pub fn self_(&self) -> Self

Roots the path at the binding target itself ($self).

Source

pub fn ancestor( &self, ancestor_type: Option<&'static TypeInfo>, level: usize, ) -> Self

Roots the path at an ancestor in the logical tree.

Source

pub fn visual_ancestor( &self, ancestor_type: Option<&'static TypeInfo>, level: usize, ) -> Self

Roots the path at an ancestor in the visual tree.

Source

pub fn element_name(&self, name_scope: NameScopeRef, name: &str) -> Self

Roots the path at a named element.

Source

pub fn indexer_property<O: 'static, K: PropertyKind>( &self, index: i32, get: impl Fn(&O, i32) -> Result<K::Typed, BindingError> + 'static, set: Option<Rc<dyn Fn(&O, i32, K::Typed) -> Result<(), BindingError>>>, ) -> Self

An indexer with one integer argument (owner[index]) on owner type O, from typed accessors that fail for a bad index. The value is re-read when the owner raises a collection change that affects index, or a property change for the indexer.

Source

pub fn list_item<T: PropertyValue>(&self, index: i32) -> Self

The item at index of a BindableList (list[index]).

Source

pub fn dictionary_item<K: Eq + Hash + Clone + Display + 'static, V: PropertyValue>( &self, key: K, ) -> Self

The entry for key of a BindableDictionary (dictionary[key]). Reading a missing key is an error; writing adds the entry.

Source

pub fn array_element(&self, indices: &[i32]) -> Self

Indexes an array with integer indexes, one per dimension.

Source

pub fn type_cast<T: ObjectType>(&self) -> Self

Casts to class T: passes an object on if it is a T, else null.

Source

pub fn type_cast_value(&self, target: CastTarget) -> Self

Casts to a class, or to a value or model type: passes a value on if it is an instance of the type (CastTarget::is_instance), else null.

Source

pub fn templated_parent(&self) -> Self

Roots the path at the templated parent of the binding target.

Source

pub fn property_untyped( &self, name: &str, property_type: ValueType, get: UntypedGetter, set: Option<UntypedSetter>, notifier: Option<AsNotifyPropertyChanged>, ) -> Self

A property whose accessors are closures over untyped values: get reads it from the handle of its owner, set (if the property can be written) writes it, and notifier (if the owner raises property change notifications) views the owner as a notifier. property_type is the type of the property’s value.

Source

pub fn property_untyped_with( &self, name: &str, property_type: ValueType, get: UntypedGetter, set: Option<UntypedSetter>, notifier: Option<AsNotifyPropertyChanged>, accepts_null: bool, ) -> Self

As property_untyped. accepts_null applies a null-conditional operator to the access: a null owner produces null instead of an error.

Source

pub fn command_untyped( &self, method_name: &str, execute: UntypedExecute, can_execute: Option<UntypedCanExecute>, depends_on_properties: &[&str], notifier: Option<AsNotifyPropertyChanged>, ) -> Self

A method used as a command, from closures over the handle of the owner. The command’s state is re-queried when the owner (viewed as a notifier by notifier) reports a change of one of depends_on_properties.

Source

pub fn method_untyped( &self, name: &str, create_delegate: UntypedCreateDelegate, accepts_null: bool, ) -> Self

A method as a delegate value: the path element produces the value create_delegate makes for the handle of the owner, usually an untyped callback (MarkupDelegate) that invokes the method on it. accepts_null applies a null-conditional operator to the access: a null owner produces null instead of an error.

Source

pub fn typed_plain_property_info_with<S: PartialEq + 'static, V: PropertyValue>( &self, info: TypedClrPropertyInfo<S, V>, accepts_null: bool, ) -> Self

A property with typed accessors on a shared model type that raises NO property change notifications: as typed_property_info_with, with the value read once per source (the typed property overload of the managed original does not require a notifying source).

Source

pub fn build(&self) -> CompiledBindingPath

The path of the elements added so far.

Source

pub fn typed_property_info<S: INotifyPropertyChanged + PartialEq + 'static, V: PropertyValue>( &self, info: TypedClrPropertyInfo<S, V>, ) -> Self

As typed_property, from a property description (which may have a fallible getter).

Source

pub fn typed_property_info_with<S: INotifyPropertyChanged + PartialEq + 'static, V: PropertyValue>( &self, info: TypedClrPropertyInfo<S, V>, accepts_null: bool, ) -> Self

As typed_property_info. accepts_null applies a null-conditional operator to the access (the three argument Property<TSource, TValue> of the managed original).

Trait Implementations§

Source§

impl Clone for CompiledBindingPathBuilder

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for CompiledBindingPathBuilder

Source§

fn default() -> Self

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

impl MarkupTyped for CompiledBindingPathBuilder

Source§

const MARKUP: &'static MarkupType

The markup metadata of the type.
Source§

impl PartialEq for CompiledBindingPathBuilder

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> PropertyValue for T
where T: Clone + PartialEq + 'static,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.