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
//! Compile-time CESR version safety via phantom types.
//!
//! The sealed [`Version`] trait and its two implementors [`V1`] and [`V2`]
//! are used as type parameters on [`CesrEncode`] to guarantee at compile time
//! that a group is only encoded with a compatible counter code table.
//!
//! [`CesrEncode`]: crate::stream::encode::CesrEncode
use BytesMut;
use crateParseError;
/// Marker trait for CESR counter code table versions.
///
/// This trait is **sealed** — only [`V1`] and [`V2`] implement it.
/// External crates cannot add new versions.
/// CESR counter code table version 1.0.
/// CESR counter code table version 2.0.
/// Encode a CESR group into a byte buffer using version `V`'s counter codes.
///
/// Shared group types (e.g. [`ControllerIdxSigs`]) implement this for both
/// [`V1`] and [`V2`]. V2-only types (e.g. [`DatagramSegmentGroup`]) only
/// implement `CesrEncode<V2>` — attempting to encode them as V1 is a
/// **compile-time error**.
///
/// [`ControllerIdxSigs`]: crate::stream::group::types::ControllerIdxSigs
/// [`DatagramSegmentGroup`]: crate::stream::group::types::DatagramSegmentGroup