Crate hex_conservative

Crate hex_conservative 

Source
Expand description

Hex encoding and decoding.

General purpose hex encoding/decoding library with a conservative MSRV and dependency policy.

§Stabilization strategy

Because downstream crates may need to return hex errors in their APIs and they need to be stabilized soon, this crate only exposes the errors and two basic decoding functions. This should already help with the vast majority of the cases and we’re sufficiently confident that these errors won’t have a breaking change any time soon (possibly never).

If you’re writing a binary you don’t need to worry about any of this and just use the unstable version for now. If you’re writing a library you should use these stable errors in the API but you may internally depend on the unstable crate version to get the advanced features that won’t affect your API. This way your API can stabilize before all features in this crate are fully stable and you still can use all of them.

§Crate feature flags

  • std - enables the standard library, on by default.
  • alloc - enables features that require allocation such as decoding into Vec<u8>, implied by std.
  • newer-rust-version - enables Rust version detection and thus newer features, may add dependency on a feature detection crate to reduce compile times. This feature is expected to do nothing once the native detection is in Rust and our MSRV is at least that version. We may also remove the feature gate in 2.0 with semver trick once that happens.

§MSRV policy

The MSRV of the crate is currently 1.63.0 and we don’t intend to bump it until the newer Rust version is at least two years old and also included in Debian stable (1.63 is in Debian 12 at the moment).

Note though that the dependencies may have looser policy. This is not considered breaking/wrong - you would just need to pin them in Cargo.lock (not .toml).

Modules§

error
The error types.

Enums§

DecodeFixedLengthBytesError
Error returned when hex decoding bytes whose length is known at compile time.
DecodeVariableLengthBytesError
Error returned when hex decoding a hex string with variable length.

Functions§

decode_to_array
Decodes a hex string with an expected length known at compile time.
decode_to_vecalloc
Decodes a hex string with variable length.