1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! # wire-codec
//!
//! Binary frame codec and protocol codec toolkit. Length-prefixed, delimiter-
//! based, and custom framing strategies. Built-in varint, zigzag, and bitfield
//! encoding. Runtime-agnostic foundation under network-protocol crates.
//!
//! # Module map
//!
//! - [`buf`] holds [`ReadBuf`] and [`WriteBuf`], the zero-copy byte cursors
//! every other module is built on.
//! - [`traits`] defines [`Encode`] and [`Decode`], the codec trait pair.
//! - [`varint`] and [`zigzag`] provide variable-length integer primitives.
//! - [`bitfield`] provides packed-bit read and write cursors.
//! - [`framing`] supplies a [`Framer`][`framing::Framer`] trait plus
//! [`LengthPrefixed`][`framing::LengthPrefixed`] and
//! [`Delimited`][`framing::Delimited`] strategies.
//!
//! # Example
//!
//! Length-prefix a payload, then read it back:
//!
//! ```
//! use wire_codec::WriteBuf;
//! use wire_codec::framing::{Endian, Framer, LengthPrefixed, LengthWidth};
//!
//! let framer = LengthPrefixed::new(LengthWidth::U16, Endian::Big);
//!
//! let mut out = [0u8; 32];
//! let mut buf = WriteBuf::new(&mut out);
//! framer.write_frame(b"ping", &mut buf).unwrap();
//! let n = buf.position();
//!
//! let frame = framer.next_frame(&out[..n]).unwrap().unwrap();
//! assert_eq!(frame.payload(), b"ping");
//! ```
//!
//! # Status
//!
//! Pre-1.0 foundation. Public API surface defined in this release; further
//! milestones expand implementations and lock semantics in.
//!
//! # License
//!
//! Dual-licensed under Apache-2.0 OR MIT.
pub use ;
pub use ;
pub use ;
pub use ;
/// Crate version string, populated by Cargo at build time.
pub const VERSION: &str = env!;