Skip to main content

Engine

Trait Engine 

Source
pub trait Engine {
    // Required methods
    fn get_name(&self) -> String;
    fn encode(&self, string: &str) -> Option<Vec<u8>>;
    fn decode(&self, bytes: &[u8]) -> String;
}
Expand description

A deencoding engine.

Required Methods§

Source

fn get_name(&self) -> String

The name of the engine.

Source

fn encode(&self, string: &str) -> Option<Vec<u8>>

Encode through the engine.

Failure to encode is allowed.

Source

fn decode(&self, bytes: &[u8]) -> String

Decode through the engine.

Failure is not accepted: any encoding charset must be covered by Unicode and therefore Rust strings.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§