Skip to main content

IConnectableCache

Trait IConnectableCache 

Source
pub trait IConnectableCache<T, K> {
    // Required methods
    fn count_changed(&self) -> Rc<dyn IObservable<usize>>;
    fn connect_with(
        &self,
        predicate: Option<Rc<dyn Fn(&T) -> bool>>,
        suppress_empty_change_sets: bool,
    ) -> Rc<dyn IObservable<ChangeSet<T, K>>>;
    fn preview_with(
        &self,
        predicate: Option<Rc<dyn Fn(&T) -> bool>>,
    ) -> Rc<dyn IObservable<ChangeSet<T, K>>>;
    fn watch(&self, key: K) -> Rc<dyn IObservable<Change<T, K>>>;

    // Provided methods
    fn connect(&self) -> Rc<dyn IObservable<ChangeSet<T, K>>> { ... }
    fn connect_filtered(
        &self,
        predicate: impl Fn(&T) -> bool + 'static,
    ) -> Rc<dyn IObservable<ChangeSet<T, K>>>
       where Self: Sized { ... }
    fn preview(&self) -> Rc<dyn IObservable<ChangeSet<T, K>>> { ... }
}
Expand description

A cache that can be observed (IConnectableCache<TObject, TKey>).

Required Methods§

Source

fn count_changed(&self) -> Rc<dyn IObservable<usize>>

The number of items, now and whenever it changes (CountChanged).

Source

fn connect_with( &self, predicate: Option<Rc<dyn Fn(&T) -> bool>>, suppress_empty_change_sets: bool, ) -> Rc<dyn IObservable<ChangeSet<T, K>>>

The items as additions, then the changes, of the items that predicate accepts; empty change sets are left out unless suppress_empty_change_sets is false (Connect).

Source

fn preview_with( &self, predicate: Option<Rc<dyn Fn(&T) -> bool>>, ) -> Rc<dyn IObservable<ChangeSet<T, K>>>

The changes before they are applied, while the items are as they were (Preview).

Source

fn watch(&self, key: K) -> Rc<dyn IObservable<Change<T, K>>>

The changes of the item of key (Watch).

Provided Methods§

Source

fn connect(&self) -> Rc<dyn IObservable<ChangeSet<T, K>>>

The items and their changes (Connect()).

Source

fn connect_filtered( &self, predicate: impl Fn(&T) -> bool + 'static, ) -> Rc<dyn IObservable<ChangeSet<T, K>>>
where Self: Sized,

The items that predicate accepts and their changes (Connect(Func<TObject, bool>)).

Source

fn preview(&self) -> Rc<dyn IObservable<ChangeSet<T, K>>>

The changes before they are applied (Preview()).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Clone + 'static, K: Eq + Hash + Clone + 'static> IConnectableCache<T, K> for IntermediateCache<T, K>

Source§

impl<T: Clone + 'static, K: Eq + Hash + Clone + 'static> IConnectableCache<T, K> for LockFreeObservableCache<T, K>

Source§

impl<T: Clone + 'static, K: Eq + Hash + Clone + 'static> IConnectableCache<T, K> for ObservableCache<T, K>

Source§

impl<T: Clone + 'static, K: Eq + Hash + Clone + 'static> IConnectableCache<T, K> for SourceCache<T, K>