ModelTypeBuilder
struct · ferroui-base · v0.5.0
struct ModelTypeBuilder<T: PartialEq + 'static>
Declares the binding metadata of model type T.
Members
notify_property_changednotify_data_error_infolistindexerarraynotify_collection_changedcommandproperty_inforead_onlypropertyvalidated_propertymethodmethod_with_can_execute
notify_property_changed
fn notify_property_changed(self: Self) -> Self
where T: INotifyPropertyChanged
Declares that the type raises property change notifications.
notify_data_error_info
fn notify_data_error_info(self: Self) -> Self
where T: INotifyDataErrorInfo
Declares that the type reports validation errors.
list
fn list(self: Self) -> Self
where T: IBindableList
Declares that the type is a list that binding indexers can index.
indexer
fn indexer(self: Self) -> Self
where T: IBindableIndexer
Declares that the type has an indexer that binding indexers can use
(Items[key]).
array
fn array(self: Self) -> Self
where T: IBindableArray
Declares that the type is an array: a fixed-size collection accessed with integer indexes, one per dimension.
notify_collection_changed
fn notify_collection_changed(self: Self) -> Self
where T: INotifyCollectionChanged
Declares that the type raises collection change notifications.
command
fn command(self: Self) -> Self
where T: ICommand
Declares that the type is a command, so that instances can be bound to command properties.
property_info
fn property_info(self: Self, property: Rc<dyn IPropertyInfo>) -> Self
Declares a property from a ready-made description.
read_only
fn read_only<K: PropertyKind>(self: Self, name: &str, get: impl Fn(&T) -> <K as >::Typed + 'static) -> Self
Declares a read-only property. K states how the typed value maps to
an untyped binding value, see PropertyKind.
property
fn property<K: PropertyKind>(self: Self, name: &str, get: impl Fn(&T) -> <K as >::Typed + 'static, set: impl Fn(&T, <K as >::Typed) -> () + 'static) -> Self
Declares a read-write property.
validated_property
fn validated_property<K: PropertyKind>(self: Self, name: &str, get: impl Fn(&T) -> <K as >::Typed + 'static, set: impl Fn(&T, <K as >::Typed) -> Result<(), BindingError> + 'static) -> Self
Declares a read-write property whose setter can reject a value. The error surfaces as a data validation error on bindings that have data validation enabled (the equivalent of throwing from a setter).
method
fn method(self: Self, name: &str, execute: impl Fn(&T, Option<&BoxedValue>) -> () + 'static) -> Self
Declares a method that bindings can use as a command.
method_with_can_execute
fn method_with_can_execute(self: Self, name: &str, execute: impl Fn(&T, Option<&BoxedValue>) -> () + 'static, can_execute: impl Fn(&T, Option<&BoxedValue>) -> bool + 'static, depends_on: &[&str]) -> Self
Declares a method with a "can execute" predicate that is re-queried
when one of the properties named in depends_on changes.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.