fmt
This commit is contained in:
parent
7c27a20ebd
commit
17446a6318
19
src/db.rs
19
src/db.rs
@ -190,7 +190,9 @@ where
|
|||||||
let tab_pos: u64 = (index * LEN_SIZE).try_into().str_err()?;
|
let tab_pos: u64 = (index * LEN_SIZE).try_into().str_err()?;
|
||||||
let mut pos_curr_data: [u8; LEN_SIZE] = [0; LEN_SIZE];
|
let mut pos_curr_data: [u8; LEN_SIZE] = [0; LEN_SIZE];
|
||||||
let cur_pos = self.input.stream_position().str_err()? as i64;
|
let cur_pos = self.input.stream_position().str_err()? as i64;
|
||||||
self.input.seek_relative((tab_pos as i64) - cur_pos).str_err()?;
|
self.input
|
||||||
|
.seek_relative((tab_pos as i64) - cur_pos)
|
||||||
|
.str_err()?;
|
||||||
|
|
||||||
self.input.read_exact(&mut pos_curr_data).str_err()?;
|
self.input.read_exact(&mut pos_curr_data).str_err()?;
|
||||||
LSize::from_le_bytes(pos_curr_data)
|
LSize::from_le_bytes(pos_curr_data)
|
||||||
@ -220,7 +222,6 @@ where
|
|||||||
pub fn iter(&mut self) -> ReaderIter<'_, T> {
|
pub fn iter(&mut self) -> ReaderIter<'_, T> {
|
||||||
ReaderIter::new(self)
|
ReaderIter::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ReaderIter<'a, T>
|
pub struct ReaderIter<'a, T>
|
||||||
@ -323,7 +324,12 @@ mod test {
|
|||||||
fn test_write_read() {
|
fn test_write_read() {
|
||||||
let dir = tempdir().expect("tempdir");
|
let dir = tempdir().expect("tempdir");
|
||||||
let tmpfile = dir.path().join("test.tmp");
|
let tmpfile = dir.path().join("test.tmp");
|
||||||
let opts = WriterOpts { compress_lvl: 1, data_buf_size: 10 * 1024 * 1024, out_buf_size: 10 * 1024 * 1024, current_buf_size: 4096 };
|
let opts = WriterOpts {
|
||||||
|
compress_lvl: 1,
|
||||||
|
data_buf_size: 10 * 1024 * 1024,
|
||||||
|
out_buf_size: 10 * 1024 * 1024,
|
||||||
|
current_buf_size: 4096,
|
||||||
|
};
|
||||||
let mut writer: Writer<TestData> = Writer::new(&tmpfile, opts).expect("new writer");
|
let mut writer: Writer<TestData> = Writer::new(&tmpfile, opts).expect("new writer");
|
||||||
|
|
||||||
let items_iter = gen_data(5);
|
let items_iter = gen_data(5);
|
||||||
@ -345,7 +351,12 @@ mod test {
|
|||||||
fn test_write_read_iter() {
|
fn test_write_read_iter() {
|
||||||
let dir = tempdir().expect("tempdir");
|
let dir = tempdir().expect("tempdir");
|
||||||
let tmpfile = dir.path().join("test.tmp");
|
let tmpfile = dir.path().join("test.tmp");
|
||||||
let opts = WriterOpts { compress_lvl: 1, data_buf_size: 10 * 1024 * 1024, out_buf_size: 10 * 1024 * 1024, current_buf_size: 4096 };
|
let opts = WriterOpts {
|
||||||
|
compress_lvl: 1,
|
||||||
|
data_buf_size: 10 * 1024 * 1024,
|
||||||
|
out_buf_size: 10 * 1024 * 1024,
|
||||||
|
current_buf_size: 4096,
|
||||||
|
};
|
||||||
let mut writer: Writer<TestData> = Writer::new(&tmpfile, opts).expect("new writer");
|
let mut writer: Writer<TestData> = Writer::new(&tmpfile, opts).expect("new writer");
|
||||||
|
|
||||||
let items_iter = gen_data(10);
|
let items_iter = gen_data(10);
|
||||||
|
Loading…
Reference in New Issue
Block a user