CompiledBindingPathBuilder
struct · ferroui-base · v0.5.0
struct CompiledBindingPathBuilder
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.
Members
newnotferro_propertyferro_property_withpropertyproperty_withtyped_propertynotifying_propertynotifying_read_only_propertycommandnotifying_commandstream_taskstream_observablestreamself_ancestorvisual_ancestorelement_nameindexer_propertylist_itemdictionary_itemarray_elementtype_castfunctionbind_backevent_handlertemplated_parentproperty_untypedproperty_untyped_withcommand_untypedmethod_untypedtyped_plain_property_info_withbuildtyped_property_infotyped_property_info_with
new
fn new() -> Self
not
fn not(self: &Self) -> Self
Negates the result of the path.
ferro_property
fn ferro_property(self: &Self, property: &'static FerroProperty) -> Self
A registered property of an object of the class hierarchy.
ferro_property_with
fn ferro_property_with(self: &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.
property
fn property(self: &Self, info: Rc<dyn IPropertyInfo>, accessor_factory: PropertyAccessorFactory) -> Self
A plain property, from its description and the factory of its accessor.
property_with
fn property_with(self: &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.
typed_property
fn typed_property<S: INotifyPropertyChanged + PartialEq + 'static, V: PropertyValue>(self: &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.
notifying_property
fn notifying_property<O: INotifyPropertyChanged + PartialEq + 'static, K: PropertyKind>(self: &Self, name: &str, get: impl Fn(&O) -> <K as >::Typed + 'static, set: impl Fn(&O, <K as >::Typed) -> () + 'static) -> Self
A read-write property of a model type that raises property change notifications, from typed accessors.
notifying_read_only_property
fn notifying_read_only_property<O: INotifyPropertyChanged + PartialEq + 'static, K: PropertyKind>(self: &Self, name: &str, get: impl Fn(&O) -> <K as >::Typed + 'static) -> Self
A read-only property of a model type that raises property change notifications, from a typed getter.
command
fn command<O: 'static>(self: &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.
notifying_command
fn notifying_command<O: INotifyPropertyChanged + 'static>(self: &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.
stream_task
fn stream_task(self: &Self) -> Self
Streams the outcome of a task (^).
stream_observable
fn stream_observable(self: &Self) -> Self
Streams the values of an observable (^).
stream
fn stream(self: &Self, plugin: Rc<dyn IStreamPlugin>) -> Self
Streams values through a custom stream plugin.
self_
fn self_(self: &Self) -> Self
Roots the path at the binding target itself ($self).
ancestor
fn ancestor(self: &Self, ancestor_type: Option<&'static TypeInfo>, level: usize) -> Self
Roots the path at an ancestor in the logical tree.
visual_ancestor
fn visual_ancestor(self: &Self, ancestor_type: Option<&'static TypeInfo>, level: usize) -> Self
Roots the path at an ancestor in the visual tree.
element_name
fn element_name(self: &Self, name_scope: NameScopeRef, name: &str) -> Self
Roots the path at a named element.
indexer_property
fn indexer_property<O: 'static, K: PropertyKind>(self: &Self, index: i32, get: impl Fn(&O, i32) -> Result<<K as >::Typed, BindingError> + 'static, set: Option<Rc<dyn Fn(&O, i32, <K as >::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.
list_item
fn list_item<T: PropertyValue>(self: &Self, index: i32) -> Self
The item at index of a BindableList (list[index]).
dictionary_item
fn dictionary_item<K: Eq + Hash + Clone + fmt::Display + 'static, V: PropertyValue>(self: &Self, key: K) -> Self
The entry for key of a BindableDictionary (dictionary[key]).
Reading a missing key is an error; writing adds the entry.
array_element
fn array_element(self: &Self, indices: &[i32]) -> Self
Indexes an array with integer indexes, one per dimension.
type_cast
fn type_cast<T: ObjectType>(self: &Self) -> Self
Casts to class T: passes an object on if it is a T, else null.
function
fn function(self: &Self, name: &str, arguments: Vec<PathFunctionArgument>, invoke: PathFunctionInvoke, notifier: Option<AsNotifyPropertyChanged>) -> Self
A function call, the last element of the path (the function step of WinUI's compiled
bindings: {x:Bind Format(Name, 'text')}, {x:Bind Model.Format(Name)},
{x:Bind local:Helpers.Format(Name)}). The elements before it give the owner of an
instance function; a function at the start of the path is called on the root source.
invoke calls it with the owner and the values of arguments, each a path read from
the root source of the expression or a constant.
Unless the binding is OneTime, the function is called again when the owner changes,
when the value of an argument path changes, and, with a notifier that views the owner
as a source of property change notifications, when the owner reports a change of a
property named as the function (or of all its properties). An argument path that cannot
be read (a null in its chain) is an error of the binding: the function is not called.
bind_back
fn bind_back(self: &Self, owner: Option<CompiledBindingPath>, value_type: ValueType, invoke: PathBindBackInvoke) -> Self
The BindBack of the function the path ends with: a TwoWay binding writes the value
of its target by calling invoke with the owner (the value of owner read from the
root source, or the root source itself) and the value, converted to value_type.
Panics
Panics if the last element of the path is not a function.
event_handler
fn event_handler(self: &Self, name: &str, invoke: PathEventHandlerInvoke) -> Self
The method an event binding of {x:Bind} calls, the last element of the path
(Click="{x:Bind OnClick}", {x:Bind Model.OnClick}, {x:Bind local:Handlers.OnClick}):
when the event is raised, invoke is called with the value of the elements before it
read from the root source (the root source itself for a method at the start of the path)
and the arguments of the event. An expression does not read the element.
templated_parent
fn templated_parent(self: &Self) -> Self
Roots the path at the templated parent of the binding target.
property_untyped
fn property_untyped(self: &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.
property_untyped_with
fn property_untyped_with(self: &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.
command_untyped
fn command_untyped(self: &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.
method_untyped
fn method_untyped(self: &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.
typed_plain_property_info_with
fn typed_plain_property_info_with<S: PartialEq + 'static, V: PropertyValue>(self: &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).
build
fn build(self: &Self) -> CompiledBindingPath
The path of the elements added so far.
typed_property_info
fn typed_property_info<S: INotifyPropertyChanged + PartialEq + 'static, V: PropertyValue>(self: &Self, info: TypedClrPropertyInfo<S, V>) -> Self
As typed_property, from a property
description (which may have a fallible getter).
typed_property_info_with
fn typed_property_info_with<S: INotifyPropertyChanged + PartialEq + 'static, V: PropertyValue>(self: &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
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherCloneDefaultPartialEqMarkupTypedValueTypeRegistration
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.