1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use store::StoreBase;
use buffer::BufferBase;
use id_manager::PrimaryIdManager;
use subsystem::SubsystemBase;
use idmgr_mode;
use ioc::{Ioc, InvocationMethod};
use std::any::Any;
use std::fmt::Debug;
use std::sync::RwLock;
pub trait ProcessBase<IdMgr, Key, SsysBase: ?Sized, StoBase: ?Sized, BufBase: ?Sized>: Any + Send + Sync
where
IdMgr: PrimaryIdManager,
Key: Debug + Ord,
SsysBase: SubsystemBase,
StoBase: StoreBase<Id = IdMgr::Id>,
BufBase: BufferBase,
{
fn _update(
&mut self,
ids: &RwLock<IdMgr>,
subsystems: &Ioc<Key, SsysBase>,
stores: &Ioc<Key, StoBase>,
buffers: &Ioc<Key, BufBase>,
);
}
pub trait Process<'a, IdMgr, Key, SsysBase: ?Sized, StoBase: ?Sized, BufBase: ?Sized>: Any + Send + Sync
where
IdMgr: PrimaryIdManager,
Key: Debug + Ord,
SsysBase: SubsystemBase,
StoBase: StoreBase<Id = IdMgr::Id>,
BufBase: BufferBase,
{
type IdMgrMode: idmgr_mode::IdMgrMode<'a, IdMgr>;
type SubsystemSelection: InvocationMethod<'a, Key, SsysBase>;
type StoreSelection: InvocationMethod<'a, Key, StoBase>;
type BufferSelection: InvocationMethod<'a, Key, BufBase>;
type IdMgr = <Self::IdMgrMode as idmgr_mode::IdMgrMode<'a, IdMgr>>::Ret;
type Subsystems = <Self::SubsystemSelection as InvocationMethod<'a, Key, SsysBase>>::Ret;
type Stores = <Self::StoreSelection as InvocationMethod<'a, Key, StoBase>>::Ret;
type Buffers = <Self::BufferSelection as InvocationMethod<'a, Key, BufBase>>::Ret;
fn update(
&mut self,
ids: <Self::IdMgrMode as idmgr_mode::IdMgrMode<'a, IdMgr>>::Ret,
subsystems: <Self::SubsystemSelection as InvocationMethod<'a, Key, SsysBase>>::Ret,
stores: <Self::StoreSelection as InvocationMethod<'a, Key, StoBase>>::Ret,
buffers: <Self::BufferSelection as InvocationMethod<'a, Key, BufBase>>::Ret,
);
}
impl<T, IdMgr, Key, SsysBase: ?Sized, StoBase: ?Sized, BufBase: ?Sized> ProcessBase<IdMgr, Key, SsysBase, StoBase, BufBase> for T
where
IdMgr: PrimaryIdManager,
Key: Debug + Ord,
SsysBase: SubsystemBase,
StoBase: StoreBase<Id = IdMgr::Id>,
BufBase: BufferBase,
T: for<'a> Process<'a, IdMgr, Key, SsysBase, StoBase, BufBase>,
{
fn _update(
&mut self,
ids: &RwLock<IdMgr>,
subsystems: &Ioc<Key, SsysBase>,
stores: &Ioc<Key, StoBase>,
buffers: &Ioc<Key, BufBase>,
){
use std::mem;
assert_eq!(0, mem::size_of::<<T::SubsystemSelection as InvocationMethod<_, _>>::Args>());
assert_eq!(0, mem::size_of::<<T::StoreSelection as InvocationMethod<_, _>>::Args>());
assert_eq!(0, mem::size_of::<<T::BufferSelection as InvocationMethod<_, _>>::Args>());
let nil1 = unsafe { mem::zeroed() };
let nil2 = unsafe { mem::zeroed() };
let nil3 = unsafe { mem::zeroed() };
self.update(
<T::IdMgrMode as idmgr_mode::IdMgrMode<IdMgr>>::retrieve(ids),
subsystems.invoke::<T::SubsystemSelection>(nil1).unwrap(),
stores.invoke::<T::StoreSelection>(nil2).unwrap(),
buffers.invoke::<T::BufferSelection>(nil3).unwrap(),
);
}
}