pub trait Codex: Send + Sync {
// Required methods
fn encode(&self, byte: u8) -> u8;
fn decode(&self, byte: u8) -> u8;
}Expand description
Byte-wise transformation applied to all stored bytes.
§Implementor contract
- Involution. For every byte
b,self.decode(self.encode(b)) == b. Equivalently, the transformation is its own inverse. - Constant-time. Implementations should be branch-free; the canonical shape is a 256-entry lookup table.
Send + Sync. Codex instances are shared across threads.