std_modrpc/roles/
multi_stream_receiver.rs1#![allow(unused_variables)]
2
3use crate::interface::MultiStreamInterface;
4use crate::proto::{MultiStreamInitState, MultiStreamItem, MultiStreamReceiverConfig};
5use modrpc::{EventRxBuilder, InterfaceRole, RoleSetup};
6
7pub struct MultiStreamReceiverHooks<T> {
8 _phantom: std::marker::PhantomData<T>,
9}
10
11pub struct MultiStreamReceiverStubs<T> {
12 pub item: EventRxBuilder<MultiStreamItem<T>>,
13 _phantom: std::marker::PhantomData<T>,
14}
15
16pub struct MultiStreamReceiverRole<T> {
17 _phantom: std::marker::PhantomData<T>,
18}
19
20impl<T: mproto::Owned> InterfaceRole for MultiStreamReceiverRole<T> {
21 type Interface = MultiStreamInterface<T>;
22 type Config = MultiStreamReceiverConfig;
23 type Init = MultiStreamInitState;
24 type Stubs = MultiStreamReceiverStubs<T>;
25 type Hooks = MultiStreamReceiverHooks<T>;
26
27 fn setup_worker(
28 i: &Self::Interface,
29 setup: &mut RoleSetup,
30 config: &Self::Config,
31 init: &Self::Init,
32 ) -> (Self::Stubs, Self::Hooks) {
33
34 (
35 Self::Stubs {
36 item: setup.event_rx(i.item),
37 _phantom: std::marker::PhantomData,
38 },
39 Self::Hooks {
40 _phantom: std::marker::PhantomData,
41 },
42 )
43 }
44}
45
46impl<T> Clone for MultiStreamReceiverHooks<T> {
47 fn clone(&self) -> Self {
48 Self {
49 _phantom: std::marker::PhantomData,
50 }
51 }
52}