tinyklv 0.1.1

The simplest Key-Length-Value (KLV) framework in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Encoders for the Basic Encoding Rules (BER)

/// Encodes a value as a BER-encoded length.
///
/// Generic over `T: OfBerLength`. The decode counterpart
/// ([`super::dec::ber_length`]) returns `usize` (type-erased). Use
/// [`BerLength`](crate::codecs::ber::BerLength) directly for type-preserving roundtrip.
///
/// See [`crate::codecs::ber::BerLength::encode_value`]
pub fn ber_length<T: super::OfBerLength>(input: T) -> Vec<u8> {
    super::BerLength::<T>::encode_value(input)
}

/// See [`crate::codecs::ber::BerOid::encode_value`]
pub fn ber_oid<T: super::OfBerOid>(input: T) -> Vec<u8> {
    super::BerOid::<T>::encode_value(input)
}