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 string and multibyte encoding.

Required Methods§

Source

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

Convert from bytes to string.

Source

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

Convert from string to bytes.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Encoder for EncoderUtf8

Source§

impl Encoder for Encoding

Available on non-Windows only.