Skip to main content

Encoder

Trait Encoder 

Source
pub trait Encoder {
    // Required methods
    fn to_string(&self, data: &[u8]) -> Result<String>;
    fn to_bytes(&self, data: &str) -> Result<Vec<u8>>;
}
Expand description

Converter between Rust strings and system multibyte encoding.

Required Methods§

Source

fn to_string(&self, data: &[u8]) -> Result<String>

Convert from bytes (system encoding) to UTF-8 string.

Source

fn to_bytes(&self, data: &str) -> Result<Vec<u8>>

Convert from UTF-8 string to bytes (system encoding).

Implementors§