Skip to main content

JournalEncoding

Trait JournalEncoding 

pub trait JournalEncoding: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn encode(&self, event: &EngineEvent) -> Result<Vec<u8>, JournalError>;
    fn decode(&self, bytes: &[u8]) -> Result<EngineEvent, JournalError>;
}
Expand description

Encode / decode an EngineEvent to / from bytes.

Required Methods§

fn name(&self) -> &'static str

Human-readable encoding name (e.g. "ndjson", "cbor").

fn encode(&self, event: &EngineEvent) -> Result<Vec<u8>, JournalError>

Serialize an event to bytes.

fn decode(&self, bytes: &[u8]) -> Result<EngineEvent, JournalError>

Deserialize an event from bytes.

Implementors§