pub struct ModelTypeBuilder<T: PartialEq + 'static> { /* private fields */ }Expand description
Declares the binding metadata of model type T.
Implementations§
Source§impl<T: PartialEq + 'static> ModelTypeBuilder<T>
impl<T: PartialEq + 'static> ModelTypeBuilder<T>
Sourcepub fn notify_property_changed(self) -> Selfwhere
T: INotifyPropertyChanged,
pub fn notify_property_changed(self) -> Selfwhere
T: INotifyPropertyChanged,
Declares that the type raises property change notifications.
Sourcepub fn notify_data_error_info(self) -> Selfwhere
T: INotifyDataErrorInfo,
pub fn notify_data_error_info(self) -> Selfwhere
T: INotifyDataErrorInfo,
Declares that the type reports validation errors.
Sourcepub fn list(self) -> Selfwhere
T: IBindableList,
pub fn list(self) -> Selfwhere
T: IBindableList,
Declares that the type is a list that binding indexers can index.
Sourcepub fn indexer(self) -> Selfwhere
T: IBindableIndexer,
pub fn indexer(self) -> Selfwhere
T: IBindableIndexer,
Declares that the type has an indexer that binding indexers can use
(Items[key]).
Sourcepub fn array(self) -> Selfwhere
T: IBindableArray,
pub fn array(self) -> Selfwhere
T: IBindableArray,
Declares that the type is an array: a fixed-size collection accessed with integer indexes, one per dimension.
Sourcepub fn notify_collection_changed(self) -> Selfwhere
T: INotifyCollectionChanged,
pub fn notify_collection_changed(self) -> Selfwhere
T: INotifyCollectionChanged,
Declares that the type raises collection change notifications.
Sourcepub fn command(self) -> Selfwhere
T: ICommand,
pub fn command(self) -> Selfwhere
T: ICommand,
Declares that the type is a command, so that instances can be bound to command properties.
Sourcepub fn property_info(self, property: Rc<dyn IPropertyInfo>) -> Self
pub fn property_info(self, property: Rc<dyn IPropertyInfo>) -> Self
Declares a property from a ready-made description.
Sourcepub fn read_only<K: PropertyKind>(
self,
name: &str,
get: impl Fn(&T) -> K::Typed + 'static,
) -> Self
pub fn read_only<K: PropertyKind>( self, name: &str, get: impl Fn(&T) -> K::Typed + 'static, ) -> Self
Declares a read-only property. K states how the typed value maps to
an untyped binding value, see PropertyKind.
Sourcepub fn property<K: PropertyKind>(
self,
name: &str,
get: impl Fn(&T) -> K::Typed + 'static,
set: impl Fn(&T, K::Typed) + 'static,
) -> Self
pub fn property<K: PropertyKind>( self, name: &str, get: impl Fn(&T) -> K::Typed + 'static, set: impl Fn(&T, K::Typed) + 'static, ) -> Self
Declares a read-write property.
Sourcepub fn validated_property<K: PropertyKind>(
self,
name: &str,
get: impl Fn(&T) -> K::Typed + 'static,
set: impl Fn(&T, K::Typed) -> Result<(), BindingError> + 'static,
) -> Self
pub fn validated_property<K: PropertyKind>( self, name: &str, get: impl Fn(&T) -> K::Typed + 'static, set: impl Fn(&T, K::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).
Sourcepub fn method(
self,
name: &str,
execute: impl Fn(&T, Option<&BoxedValue>) + 'static,
) -> Self
pub fn method( self, name: &str, execute: impl Fn(&T, Option<&BoxedValue>) + 'static, ) -> Self
Declares a method that bindings can use as a command.
Sourcepub fn method_with_can_execute(
self,
name: &str,
execute: impl Fn(&T, Option<&BoxedValue>) + 'static,
can_execute: impl Fn(&T, Option<&BoxedValue>) -> bool + 'static,
depends_on: &[&str],
) -> Self
pub fn method_with_can_execute( 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.
Auto Trait Implementations§
impl<T> !RefUnwindSafe for ModelTypeBuilder<T>
impl<T> !Send for ModelTypeBuilder<T>
impl<T> !Sync for ModelTypeBuilder<T>
impl<T> !UnwindSafe for ModelTypeBuilder<T>
impl<T> Freeze for ModelTypeBuilder<T>
impl<T> Unpin for ModelTypeBuilder<T>
impl<T> UnsafeUnpin for ModelTypeBuilder<T>
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more