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