uvarint 0.1.1

unsigned varint
Documentation
  • Coverage
  • 27.27%
    3 out of 11 items documented3 out of 4 items with examples
  • Size
  • Source code size: 25.12 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.66 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • aoikurokawa

UNSIGNED_VARINT

Core Features Encoding/Decoding:

Encode u32, u64, u128 to varint bytes Decode varint bytes back to integers Handle both owned (Vec) and borrowed (&[u8]) data Return number of bytes written/read

Error Handling:

Detect buffer overflow (not enough space to encode) Detect truncated data (incomplete varint) Detect overflow (varint too large for target type) Clear error types, not just Result<T, ()>

Zero-Copy Operations:

Read from byte slices without allocation Write to pre-allocated buffers std::io::Read and std::io::Write trait implementations

Important Features Performance:

Inline functions for hot paths Benchmarks comparing to existing libraries Optional SIMD optimizations for batch operations #[no_std] support for embedded systems

Ergonomics:

Trait-based API (e.g., VarIntEncode, VarIntDecode) Helper functions like encoded_len(value) to predict size Builder pattern for configuration if needed Good type inference support

Compatibility:

Support multiple varint formats (LEB128, Protocol Buffers, etc.) Feature flags for different encodings Async I/O support (tokio::AsyncRead/AsyncWrite)

Nice-to-Have Features Advanced:

Streaming decoder for parsing continuous streams Batch encoding/decoding APIs serde support for serialization frameworks Zero-allocation iterators over varint sequences Const functions where possible (for compile-time encoding)

Developer Experience:

Comprehensive examples in docs Comparison guide with other libraries Migration guide if competing with existing crates Clear performance characteristics documented