pub struct Property<T> { /* private fields */ }
Implementations§
Source§impl<T: 'static + Clone + PartialEq> Property<T>
impl<T: 'static + Clone + PartialEq> Property<T>
pub fn new<U: Into<T>>(val: U) -> Self
pub fn binded_from(src_property: &Property<T>) -> Self
pub fn binded_c_from<TSrc: 'static + Clone + PartialEq, F: 'static + Fn(TSrc) -> T>( src_property: &Property<TSrc>, f: F, ) -> Self
pub fn binded_to(dst_property: &Property<T>, init_value: T) -> Self
pub fn binded_c_to<TDst: 'static + Clone + PartialEq, F: 'static + Fn(T) -> TDst>( dst_property: &Property<TDst>, f: F, init_value: T, ) -> Self
pub fn binded_two_way(other_property: &Property<T>) -> Self
pub fn binded_c_two_way<TOther, F1, F2>( other_property: &Property<TOther>, f1: F1, f2: F2, ) -> Self
pub fn set(&self, val: T)
pub fn change<F: 'static + Fn(T) -> T>(&self, f: F)
pub fn get(&self) -> T
pub fn bind(&self, src_property: &Property<T>)
pub fn bind_c<TSrc: 'static + Clone + PartialEq, F: 'static + Fn(TSrc) -> T>( &self, src_property: &Property<TSrc>, f: F, )
pub fn on_changed<F: 'static + FnMut(T)>(&self, f: F) -> Subscription
Trait Implementations§
Source§impl<V> From<&Property<Option<Rc<V>>>> for Box<dyn ObservableCollection<Rc<RefCell<dyn ControlObject>>>>
impl<V> From<&Property<Option<Rc<V>>>> for Box<dyn ObservableCollection<Rc<RefCell<dyn ControlObject>>>>
Source§impl From<&Property<Rc<RefCell<dyn ControlObject>>>> for Box<dyn ObservableCollection<Rc<RefCell<dyn ControlObject>>>>
Converts Property to observable collection.
impl From<&Property<Rc<RefCell<dyn ControlObject>>>> for Box<dyn ObservableCollection<Rc<RefCell<dyn ControlObject>>>>
Converts Property to observable collection.
Source§impl<V> From<&Property<Rc<V>>> for Box<dyn ObservableCollection<Rc<RefCell<dyn ControlObject>>>>
impl<V> From<&Property<Rc<V>>> for Box<dyn ObservableCollection<Rc<RefCell<dyn ControlObject>>>>
Source§impl<T> From<&Property<T>> for Property<T>
Allows to easily write one-way binding.
impl<T> From<&Property<T>> for Property<T>
Allows to easily write one-way binding.
Example:
ui! { Control { text_property: &vm.text }}
Source§impl<T> From<&mut Property<T>> for Property<T>
Allows to easily write two-way bindings.
impl<T> From<&mut Property<T>> for Property<T>
Allows to easily write two-way bindings.
Example:
ui! { Control { text_property: &mut vm.text }}
Source§impl<TSrc, TDest, F> From<(&Property<TSrc>, F)> for Property<TDest>
Allows to easily write one-way binding with converter.
impl<TSrc, TDest, F> From<(&Property<TSrc>, F)> for Property<TDest>
Allows to easily write one-way binding with converter.
Example:
ui! { Control { text_property: (&vm.count, |c| c.to_string()) }}
Source§impl<TSrc, TDest, F1, F2> From<(&mut Property<TSrc>, F1, F2)> for Property<TDest>
Allows to easily write two-way binding with converter.
impl<TSrc, TDest, F1, F2> From<(&mut Property<TSrc>, F1, F2)> for Property<TDest>
Allows to easily write two-way binding with converter.
Example:
ui! { Control { text_property: (&mut vm.count, |c| c.to_string(), |c| c.parse().unwrap()) }}
Source§impl<T, U> From<U> for Property<T>
Allows to convert types attributed with IntoProperty to Property.
impl<T, U> From<U> for Property<T>
Allows to convert types attributed with IntoProperty to Property
Cannot do it for all types at once, because then there is a conflict with binding conversions (tuples and properties used as source).
Example:
ui! { Control { int_property: 10, text_property: “My Text” }}
Source§impl<T> ObservableCollection<T> for Property<Option<T>>
impl<T> ObservableCollection<T> for Property<Option<T>>
Auto Trait Implementations§
impl<T> Freeze for Property<T>
impl<T> RefUnwindSafe for Property<T>
impl<T> !Send for Property<T>
impl<T> !Sync for Property<T>
impl<T> Unpin for Property<T>
impl<T> UnwindSafe for Property<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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, TSrcColl> ObservableCollectionExt<T> for TSrcCollwhere
T: 'static + Clone,
TSrcColl: ObservableCollection<T> + 'static,
impl<T, TSrcColl> ObservableCollectionExt<T> for TSrcCollwhere
T: 'static + Clone,
TSrcColl: ObservableCollection<T> + 'static,
Source§fn map<TDst, F>(&self, f: F) -> ObservableCollectionMap<TDst>
fn map<TDst, F>(&self, f: F) -> ObservableCollectionMap<TDst>
Map creates new observable collection.
It keeps mapped copy of every item.
The only connection between it and original observable collection
is by subscribing on the on_changed
event of the source collection,
so we don’t have to keep implicit reference to the source collection.
The on_change
event of source collection keeps a weak reference to our handler.
Source§impl<TSrc, TSrcColl> ObservableCollectionFlatMapExt<TSrc> for TSrcCollwhere
TSrc: Clone + 'static,
TSrcColl: ObservableCollection<TSrc> + 'static,
impl<TSrc, TSrcColl> ObservableCollectionFlatMapExt<TSrc> for TSrcCollwhere
TSrc: Clone + 'static,
TSrcColl: ObservableCollection<TSrc> + 'static,
Source§fn flat_map<TDst, TDstColl, F>(&self, f: F) -> ObservableCollectionFlatMap<TDst>where
TDst: Clone + 'static,
TDstColl: ObservableCollection<TDst> + IntoIterator<Item = TDst>,
F: FnMut(&TSrc) -> TDstColl + 'static,
fn flat_map<TDst, TDstColl, F>(&self, f: F) -> ObservableCollectionFlatMap<TDst>where
TDst: Clone + 'static,
TDstColl: ObservableCollection<TDst> + IntoIterator<Item = TDst>,
F: FnMut(&TSrc) -> TDstColl + 'static,
Flat map creates new observable collection.
It keeps mapped copy of every item.
The only connection between it and original observable collection
is by subscribing on the on_changed
event of the source collection,
so we don’t have to keep implicit reference to the source collection.
The on_change
event of source collection keeps a weak reference to our handler.