Skip to content

Instantly share code, notes, and snippets.

@vanhtuan0409
Created November 25, 2020 04:30
Show Gist options
  • Save vanhtuan0409/d2dcc6bc2b49ec0fed316fbb3b5ef591 to your computer and use it in GitHub Desktop.
Save vanhtuan0409/d2dcc6bc2b49ec0fed316fbb3b5ef591 to your computer and use it in GitHub Desktop.
use std::io::{Read, Write, Seek};
trait DataSink: Read + Write + Seek {}
trait Encoder<R: Read, W: Write> {
fn read_record(&self, input: R) -> Result<Entry, ()>;
fn write_record(&self, output: W, entry: &Entry) -> Result<(), ()>;
}
struct WAL<T: DataSink> {
sink: T,
encoder: Box<dyn Encoder>, // ???? encoder should have reference to data sink
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment