1#![cfg_attr(not(feature = "std"), no_std)]
21extern crate alloc;
22
23pub mod common;
24pub mod core;
25pub mod network;
26pub mod scouting;
27pub mod transport;
28pub mod zenoh;
29
30use ::core::marker::PhantomData;
31use zenoh_protocol::core::Reliability;
32
33pub trait WCodec<Message, Buffer> {
34 type Output;
35 fn write(self, buffer: Buffer, message: Message) -> Self::Output;
36}
37
38pub trait RCodec<Message, Buffer> {
39 type Error;
40 fn read(self, buffer: Buffer) -> Result<Message, Self::Error>;
41}
42
43pub trait LCodec<Message> {
45 fn w_len(self, message: Message) -> usize;
46}
47
48#[derive(Clone, Copy)]
49pub struct Zenoh080;
50
51impl Default for Zenoh080 {
52 fn default() -> Self {
53 Self::new()
54 }
55}
56
57impl Zenoh080 {
58 pub const fn new() -> Self {
59 Self
60 }
61}
62
63#[derive(Clone, Copy)]
64pub struct Zenoh080Header {
65 pub header: u8,
66 pub codec: Zenoh080,
67}
68
69impl Zenoh080Header {
70 pub const fn new(header: u8) -> Self {
71 Self {
72 header,
73 codec: Zenoh080,
74 }
75 }
76}
77
78#[derive(Clone, Copy)]
79pub struct Zenoh080Condition {
80 pub condition: bool,
81 pub codec: Zenoh080,
82}
83
84impl Zenoh080Condition {
85 pub const fn new(condition: bool) -> Self {
86 Self {
87 condition,
88 codec: Zenoh080,
89 }
90 }
91}
92
93#[derive(Clone, Copy)]
94pub struct Zenoh080Length {
95 pub length: usize,
96 pub codec: Zenoh080,
97}
98
99impl Zenoh080Length {
100 pub const fn new(length: usize) -> Self {
101 Self {
102 length,
103 codec: Zenoh080,
104 }
105 }
106}
107
108#[derive(Clone, Copy)]
109pub struct Zenoh080Reliability {
110 pub reliability: Reliability,
111 pub codec: Zenoh080,
112}
113
114impl Zenoh080Reliability {
115 pub const fn new(reliability: Reliability) -> Self {
116 Self {
117 reliability,
118 codec: Zenoh080,
119 }
120 }
121}
122
123#[derive(Clone, Copy)]
124pub struct Zenoh080Bounded<T> {
125 _t: PhantomData<T>,
126}
127
128impl<T> Default for Zenoh080Bounded<T> {
129 fn default() -> Self {
130 Self::new()
131 }
132}
133
134impl<T> Zenoh080Bounded<T> {
135 pub const fn new() -> Self {
136 Self { _t: PhantomData }
137 }
138}
139
140#[cfg(feature = "shared-memory")]
141#[derive(Clone, Copy)]
142pub struct Zenoh080Sliced<T> {
143 is_sliced: bool,
144 codec: Zenoh080Bounded<T>,
145}
146
147#[cfg(feature = "shared-memory")]
148impl<T> Zenoh080Sliced<T> {
149 pub const fn new(is_sliced: bool) -> Self {
150 Self {
151 is_sliced,
152 codec: Zenoh080Bounded::<T>::new(),
153 }
154 }
155}