Skip to main content

Codec

Trait Codec 

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

Encoding/decoding strategy used in human-readable mode.

Required Methods§

Source

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

Render bytes as the human-readable string form.

Source

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

Parse the human-readable string form back into bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§