synta 0.1.1

ASN.1 parser, decoder, and encoder library with DER/BER support and C FFI
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Internal serde utilities used by the `serde` feature implementations.

#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};

/// Encode bytes as a lowercase hexadecimal string.
pub(crate) fn bytes_to_hex(bytes: &[u8]) -> String {
    crate::hex::bytes_to_hex(bytes)
}

/// Decode a hexadecimal string into bytes, mapping the error to a serde error.
pub(crate) fn hex_to_bytes<E: serde::de::Error>(s: &str) -> Result<Vec<u8>, E> {
    crate::hex::hex_to_bytes(s).map_err(E::custom)
}