Trait irox_tools::codec::Codec
source · pub trait Codec {
// Required methods
fn encode<I: Bits, O: MutBits>(
&self,
input: I,
output: &mut O
) -> Result<usize, Error>;
fn decode<I: Bits, O: MutBits>(
&self,
input: I,
output: &mut O
) -> Result<usize, Error>;
// Provided methods
fn encode_to_str<I: Bits>(&self, input: I) -> Result<String, Error> { ... }
fn encode_to_vec<I: Bits>(&self, input: I) -> Result<Vec<u8>, Error> { ... }
fn decode_to_str_lossy<I: Bits>(&self, input: I) -> Result<String, Error> { ... }
fn decode_to_vec<I: Bits>(&self, input: I) -> Result<Vec<u8>, Error> { ... }
}Expand description
Something that can encode or decode bytes to bytes
Required Methods§
Provided Methods§
sourcefn encode_to_str<I: Bits>(&self, input: I) -> Result<String, Error>
fn encode_to_str<I: Bits>(&self, input: I) -> Result<String, Error>
Reads the entirety of the input in the raw format, and produces the encoded UTF-8 results in an owned string.
sourcefn encode_to_vec<I: Bits>(&self, input: I) -> Result<Vec<u8>, Error>
fn encode_to_vec<I: Bits>(&self, input: I) -> Result<Vec<u8>, Error>
Reads the entirety of the input in the raw format, and produces the encoded results in an owned Vec
Object Safety§
This trait is not object safe.