musli_binary_common/
encoding.rs

1//! Helpers for determining integer encoding at compile time.
2
3use core::marker;
4
5use crate::int::NetworkEndian;
6
7/// Type that indicates that the given numerical type should use variable-length
8/// encoding.
9#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
10#[non_exhaustive]
11pub enum Variable {}
12
13/// A fixed-length integer encoding which encodes something to a little-endian
14/// encoding.
15#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16#[non_exhaustive]
17pub struct Fixed<B = NetworkEndian> {
18    _marker: marker::PhantomData<B>,
19}
20
21/// A fixed-length encoding which encodes numbers to the width of `L` and the
22/// endianness of `B`.
23#[derive(Debug, Clone, Copy)]
24#[non_exhaustive]
25pub struct FixedLength<L = u32, B = NetworkEndian> {
26    _marker: marker::PhantomData<(L, B)>,
27}