std_modrpc/roles/
byte_stream_sender.rs1#![allow(unused_variables)]
2
3use crate::interface::ByteStreamInterface;
4use crate::proto::{ByteStreamInitState, ByteStreamSenderConfig};
5use modrpc::{EventTx, InterfaceRole, RoleSetup};
6
7pub struct ByteStreamSenderHooks {
8 pub blob: EventTx<()>,
9}
10
11pub struct ByteStreamSenderStubs {}
12
13pub struct ByteStreamSenderRole {}
14
15impl InterfaceRole for ByteStreamSenderRole {
16 type Interface = ByteStreamInterface;
17 type Config = ByteStreamSenderConfig;
18 type Init = ByteStreamInitState;
19 type Stubs = ByteStreamSenderStubs;
20 type Hooks = ByteStreamSenderHooks;
21
22 fn setup_worker(
23 i: &Self::Interface,
24 setup: &mut RoleSetup,
25 config: &Self::Config,
26 init: &Self::Init,
27 ) -> (Self::Stubs, Self::Hooks) {
28
29 (
30 Self::Stubs {},
31 Self::Hooks {
32 blob: setup.event_tx(i.blob),
33 },
34 )
35 }
36}
37
38impl Clone for ByteStreamSenderHooks {
39 fn clone(&self) -> Self {
40 Self {
41 blob: self.blob.clone(),
42 }
43 }
44}