pub const fn encoded_len(
collection_len: usize,
doc_id_len: usize,
body_len: usize,
) -> Option<usize>Expand description
Encoded length of a Document envelope with the given field sizes,
excluding the 16-byte peat-lite header. Useful for callers
preflight-checking a buffer against [MAX_PAYLOAD_SIZE] before
committing to a single-packet send vs. fragmentation.
Returns None on usize overflow — relevant on 32-bit targets
(ESP32, LoRa MCUs) when callers pass user-controlled lengths. With
today’s per-field maxima the worst case sums to ~131 KB which fits
32-bit usize comfortably; the guard exists to keep that
invariant explicit if a future field expansion ever drives the
total higher.