Created
November 25, 2020 04:30
-
-
Save vanhtuan0409/d2dcc6bc2b49ec0fed316fbb3b5ef591 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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