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
use crate::cell::Cell;
use crate::impl_::cell_sink::CellSink as CellSinkImpl;
use crate::sodium_ctx::SodiumCtx;

pub struct CellSink<A> {
    pub impl_: CellSinkImpl<A>,
}

impl<A> Clone for CellSink<A> {
    fn clone(&self) -> Self {
        CellSink {
            impl_: self.impl_.clone(),
        }
    }
}

impl<A: Clone + Send + 'static> CellSink<A> {
    pub fn new(sodium_ctx: &SodiumCtx, a: A) -> CellSink<A> {
        CellSink {
            impl_: CellSinkImpl::new(&sodium_ctx.impl_, a),
        }
    }

    pub fn cell(&self) -> Cell<A> {
        Cell {
            impl_: self.impl_.cell(),
        }
    }

    pub fn send(&self, a: A) {
        self.impl_.send(a);
    }
}