#varint #const-context #protobuf #leb128

no-std const-varint

Protobuf's varint encoding/decoding with full const context operations supports

7 unstable releases (3 breaking)

new 0.4.0 Mar 23, 2025
0.3.4 Mar 22, 2025
0.2.1 Feb 6, 2025
0.1.1 Feb 3, 2025

#807 in Network programming

Download history 657/week @ 2025-02-02 249/week @ 2025-02-09 1653/week @ 2025-02-16 1030/week @ 2025-02-23 1408/week @ 2025-03-02 408/week @ 2025-03-09 399/week @ 2025-03-16

3,769 downloads per month
Used in 16 crates (3 directly)

MIT/Apache

66KB
1.5K SLoC

const-varint

Protobuf's varint encoding/decoding with full const context operations supports.

github LoC Build codecov

docs.rs crates.io crates.io license

Installation

[dependencies]
const-varint = "0.4"
  • For u1, u2, u3, .., u127

    const-varint = { version = "0.4", features = "arbitrary-int" }
    
  • For ruint::Uint<BITS, LBITS> support (not compatible in const context)

    const-varint = { version = "0.4", features = ["ruint"] }
    
  • For primitive-types support (not compatible in const context)

    const-varint = { version = "0.4", features = ["primitive-types"] }
    
  • For ethereum-types support (not compatible in const context)

    const-varint = { version = "0.4", features = ["ethereum-types"] }
    

License

const-varint is under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT for details.

Copyright (c) 2025 Al Liu.

Dependencies

~0.2–0.9MB
~20K SLoC