1use gcollections::kind::*;
16use std::ops::{Deref, DerefMut};
17
18pub trait StoreMonotonicUpdate<Store: Collection>
19{
20 fn update(&mut self, store: &mut Store, value: Store::Item) -> bool;
21}
22
23pub trait StoreRead<Store: Collection>
24{
25 fn read(&self, store: &Store) -> Store::Item;
26}
27
28pub trait ViewDependencies<Event>
29{
30 fn dependencies(&self, event: Event) -> Vec<(usize, Event)>;
31}
32
33impl<Store, R> StoreMonotonicUpdate<Store> for Box<R> where
34 R: StoreMonotonicUpdate<Store>,
35 Store: Collection
36{
37 fn update(&mut self, store: &mut Store, value: Store::Item) -> bool {
38 self.deref_mut().update(store, value)
39 }
40}
41
42impl<Store, R> StoreRead<Store> for Box<R> where
43 R: StoreRead<Store>,
44 Store: Collection
45{
46 fn read(&self, store: &Store) -> Store::Item {
47 self.deref().read(store)
48 }
49}
50
51impl<Event, R> ViewDependencies<Event> for Box<R> where
52 R: ViewDependencies<Event>
53{
54 fn dependencies(&self, event: Event) -> Vec<(usize, Event)> {
55 self.deref().dependencies(event)
56 }
57}