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
use super::*;
use crate::core::Core;

pub mod imp;

pub struct Handler<S,E> where S: GuionHandler<E>, E: Env + Sync + 'static {
    pub sup: S,
    pub inner: Core<E>,
}

impl<S,E> Handler<S,E> where S: GuionHandler<E>, E: Env + Sync + 'static {
    pub fn new(inner: Core<E>, sup: S) -> Self {
        Self{
            sup,
            inner,
        }
    }
}

/*impl<S,E> AsRefMut<HandlerInner> for Handler<S,E> where S: GuionHandler<E>, E: Env + 'static {
    #[inline]
    fn as_ref(&self) -> &HandlerInner {
        &self.inner
    }
    #[inline]
    fn as_mut(&mut self) -> &mut HandlerInner {
        &mut self.inner
    }
}

impl<S,E> AsHandler<Self,E> for Handler<S,E> where S: GuionHandler<E>, E: Env, E::Context: GuionContext<E,Handler=Self> {
    fn as_mut(c: &mut E::Context) -> &mut Self {
        c._handler_mut()
    }
    fn as_ref(c: &E::Context) -> &Self {
        c._handler()
    }
}

impl<S,E> AsHandler<S,E> for Handler<S,E> where S: GuionHandler<E>, E: Env, E::Context: GuionContext<E,Handler=Self> {
    fn as_mut(c: &mut E::Context) -> &mut S {
        &mut c._handler_mut().sup
    }
    fn as_ref(c: &E::Context) -> &S {
        &c._handler().sup
    }
}*/