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 Self::Stubs {},
30 Self::Hooks {
31 blob: setup.event_tx(i.blob),
32 },
33 )
34 }
35}
36
37impl Clone for ByteStreamSenderHooks {
38 fn clone(&self) -> Self {
39 Self {
40 blob: self.blob.clone(),
41 }
42 }
43}