serde_encoded_bytes/encoding/traits.rs
1use alloc::{string::String, vec::Vec};
2
3use serde::de;
4
5/// A trait for encoding bytes into strings.
6pub trait Encoding {
7 /// Encodes the byte sequence.
8 fn encode(bytes: &[u8]) -> String;
9
10 /// Decodes the byte sequence.
11 fn decode<E: de::Error>(string: &str) -> Result<Vec<u8>, E>;
12}