wrpc_transport/frame/
mod.rs1use std::sync::Arc;
4
5use bytes::Bytes;
6
7mod codec;
8mod conn;
9
10#[cfg(any(target_family = "wasm", feature = "net"))]
11pub mod tcp;
12
13#[cfg(all(unix, feature = "net"))]
14pub mod unix;
15
16pub use codec::*;
17pub use conn::*;
18
19pub const PROTOCOL: u8 = 0;
21
22#[derive(Clone, Debug, Eq, PartialEq)]
24pub struct Frame {
25 pub path: Arc<[usize]>,
27 pub data: Bytes,
29}
30
31#[derive(Clone, Debug, Eq, PartialEq)]
33pub struct FrameRef<'a> {
34 pub path: &'a [usize],
36 pub data: &'a [u8],
38}
39
40impl<'a> From<&'a Frame> for FrameRef<'a> {
41 fn from(Frame { path, data }: &'a Frame) -> Self {
42 Self {
43 path: path.as_ref(),
44 data: data.as_ref(),
45 }
46 }
47}