Skip to main content

Encoder

Trait Encoder 

Source
pub trait Encoder {
    type Error: Error;

    // Required methods
    fn to_text(&self, input: &[u8]) -> String;
    fn from_text(&self, input: &str) -> Result<Vec<u8>, Self::Error>;
}
Expand description

The trait for encoders to encode to / decode from string.

Required Associated Types§

Required Methods§

Source

fn to_text(&self, input: &[u8]) -> String

Source

fn from_text(&self, input: &str) -> Result<Vec<u8>, Self::Error>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§