xio_base_datatypes/
module_channel_reference.rs1pub trait IsModuleChannelReference {}
2
3#[derive(Clone, Debug, PartialEq)]
4pub struct ModuleChannelReference {
5 pub module_id: u16,
6 pub channel_id: u16,
7}
8
9impl IsModuleChannelReference for ModuleChannelReference {}
10
11impl From<u64> for ModuleChannelReference {
12 fn from(v: u64) -> Self {
13 let module_id = (v >> 16) as u16;
14 let channel_id = (v) as u16;
15 ModuleChannelReference {
16 module_id,
17 channel_id,
18 }
19 }
20}
21
22impl Into<u64> for ModuleChannelReference {
23 fn into(self) -> u64 {
24 let Self {
25 module_id,
26 channel_id,
27 } = self;
28 (u64::from(module_id) << 16) | u64::from(channel_id)
29 }
30}
31
32impl<'a> Into<u64> for &'a ModuleChannelReference {
33 fn into(self) -> u64 {
34 (u64::from(self.module_id) << 16) | u64::from(self.channel_id)
35 }
36}