serde_encoded_bytes

Trait Encoding

Source
pub trait Encoding {
    // Required methods
    fn encode(bytes: &[u8]) -> String;
    fn decode<E: Error>(string: &str) -> Result<Vec<u8>, E>;
}
Expand description

A trait for encoding bytes into strings.

Required Methods§

Source

fn encode(bytes: &[u8]) -> String

Encodes the byte sequence.

Source

fn decode<E: Error>(string: &str) -> Result<Vec<u8>, E>

Decodes the byte sequence.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Encoding for Base64

Available on crate feature base64 only.
Source§

impl Encoding for Hex

Available on crate feature hex only.