nativeview-codec
Zero-unsafe (#![forbid(unsafe_code)]), zero-runtime-dependency Tier-2 little-endian binary framing primitives (ByteReader, ByteWriter, CodecError, NvEncode, NvDecode) and #[derive(NvCodec)] (packages/core/codec, Core Foundation layer, strictly below nativeview-abi).
Key Public API
ByteReader<'a>— strictly bounds-checked LE reader (strict0|1bools, canonical LE floats, boundedread_bytes/read_str/read_vec,expect_magic,expect_zero,finish()).ByteWriter— reusable LE writer (clear(),with_buf(), checkedpatch_u32/write_zeroes, length-prefixed slices/strings/sequences).SliceWriter<'a>— zero-allocation fixed-slice LE writer over&mut [u8]with exact-fillfinish().StackWriter<'a>,with_stack_writer<N>,try_with_stack_writer<N>, and canonical float stack encoders (encode_f32_stack,encode_f64_stack) — zero-allocation fast-path encoding into[u8; N]spilling toVec<u8>only on overflow.ByteTransport&TransportError— pluggable binary sync/async byte transport with zero-copy borrowed reply delivery (call_sync_decode).CodecError— typed, allocation-free binary framing error (Truncated,BadMagic,BadVersion,BadEnum,BadBool,NonZeroReserved,LenOverflow,TrailingBytes,InvalidUtf8).NvEncode/NvDecodeand#[derive(NvCodec)].
use ;
let msg = Ping ;
let bytes = msg.encode_to_vec.unwrap;
assert_eq!;
let mut w = with_capacity;
w.write_u32;
let mut r = new;
assert_eq!;
r.finish.unwrap;
Dependency Invariants
- Depends ONLY on:
nativeview-abi-macros(zero-dependency proc-macro crate), keeping the core DAG strictly acyclic belownativeview-abi. - Must NOT depend on:
nativeview-abi,serde*, platform crates, orpackages/modules/*.
Verification