pub struct DynamicViewModel { /* private fields */ }
Expand description
The dynamic viewmodel lets us define arbitrary properties as bound or computed values. A particular key can only be bound or computed: if it is set as both, the computed version ‘wins’.
Implementations§
Source§impl DynamicViewModel
impl DynamicViewModel
Sourcepub fn new() -> DynamicViewModel
pub fn new() -> DynamicViewModel
Creates a new dynamic viewmodel
Sourcepub fn set_computed<TFn>(&self, property_name: &str, calculate_value: TFn)
pub fn set_computed<TFn>(&self, property_name: &str, calculate_value: TFn)
Sets a binding to a computed value
Trait Implementations§
Source§impl ViewModel for DynamicViewModel
impl ViewModel for DynamicViewModel
Source§fn get_property(&self, property_name: &str) -> BindRef<PropertyValue>
fn get_property(&self, property_name: &str) -> BindRef<PropertyValue>
Retrieves a property
Source§fn set_property(&self, property_name: &str, new_value: PropertyValue)
fn set_property(&self, property_name: &str, new_value: PropertyValue)
Updates a property
Source§fn get_property_names(&self) -> Vec<String>
fn get_property_names(&self) -> Vec<String>
Retrieves the names of all of the properties in this item
Auto Trait Implementations§
impl !Freeze for DynamicViewModel
impl !RefUnwindSafe for DynamicViewModel
impl Send for DynamicViewModel
impl Sync for DynamicViewModel
impl Unpin for DynamicViewModel
impl !UnwindSafe for DynamicViewModel
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
Mutably borrows from an owned value. Read more