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 Self::Stubs {
35 item: setup.event_rx(i.item),
36 _phantom: std::marker::PhantomData,
37 },
38 Self::Hooks {
39 _phantom: std::marker::PhantomData,
40 },
41 )
42 }
43}
44
45impl<T> Clone for MultiStreamReceiverHooks<T> {
46 fn clone(&self) -> Self {
47 Self {
48 _phantom: std::marker::PhantomData,
49 }
50 }
51}