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
//! # vexil-runtime
//!
//! Runtime support library for [Vexil](https://github.com/vexil-lang/vexil)
//! generated code. Provides the [`Pack`] and [`Unpack`] traits plus
//! [`BitWriter`] / [`BitReader`] for LSB-first bit-packed encoding and decoding.
//!
//! This crate is a dependency of code generated by `vexilc codegen`. You
//! generally don't use it directly — the generated `Pack` and `Unpack` impls
//! call into it.
//!
//! ## Encoding Model
//!
//! - Sub-byte fields are packed LSB-first within each byte
//! - Multi-byte integers use little-endian byte order
//! - `@varint` fields use unsigned LEB128
//! - `@zigzag` fields use ZigZag encoding + LEB128
//! - Strings and byte arrays are length-prefixed with LEB128
pub use BitReader;
pub use BitWriter;
pub use ;
pub use ;
pub use ;
/// Maximum allowed byte length for strings and byte arrays (64 MiB).
///
/// Decoding a string or `bytes` field whose LEB128 length prefix exceeds this
/// value produces [`DecodeError::LimitExceeded`].
pub const MAX_BYTES_LENGTH: u64 = 1 << 26;
/// Maximum allowed element count for collections (16 M items).
///
/// Used by generated code to cap list/map sizes during decoding.
pub const MAX_COLLECTION_COUNT: u64 = 1 << 24;
/// Maximum number of bytes consumed when reading a LEB128 length prefix.
///
/// Limits the length prefix to at most 4 bytes (values up to 2^28 - 1).
pub const MAX_LENGTH_PREFIX_BYTES: u8 = 4;
/// Maximum nesting depth for recursive types.
///
/// [`BitReader::enter_recursive`] returns [`DecodeError::RecursionLimitExceeded`]
/// when the depth exceeds this value.
pub const MAX_RECURSION_DEPTH: u32 = 64;