diff options
author | Paul Masurel <paul.masurel@gmail.com> | 2018-01-25 12:46:32 +0900 |
---|---|---|
committer | Paul Masurel <paul.masurel@gmail.com> | 2018-01-25 12:46:32 +0900 |
commit | 3edb3dce6a8fdde9cbca118742d6133f9ea2043b (patch) | |
tree | 352fd4c4c6546f6ead7ac90eae9fe53e03d966d8 /src/fastfield/serializer.rs | |
parent | 1edaf7a3126eda8be6c50592c53b3b0fc19cb9bf (diff) |
Test not passing
Diffstat (limited to 'src/fastfield/serializer.rs')
-rw-r--r-- | src/fastfield/serializer.rs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/fastfield/serializer.rs b/src/fastfield/serializer.rs index 0445373..afce4f0 100644 --- a/src/fastfield/serializer.rs +++ b/src/fastfield/serializer.rs @@ -35,7 +35,7 @@ impl FastFieldSerializer { pub fn from_write(write: WritePtr) -> io::Result<FastFieldSerializer> { // just making room for the pointer to header. let composite_write = CompositeWrite::wrap(write); - Ok(FastFieldSerializer { composite_write }) + Ok(FastFieldSerializer { composite_write: composite_write }) } /// Start serializing a new u64 fast field @@ -45,10 +45,21 @@ impl FastFieldSerializer { min_value: u64, max_value: u64, ) -> io::Result<FastSingleFieldSerializer<CountingWriter<WritePtr>>> { - let field_write = self.composite_write.for_field(field); + self.new_u64_fast_field_with_idx(field, min_value, max_value, 0) + } + + /// Start serializing a new u64 fast field + pub fn new_u64_fast_field_with_idx( + &mut self, + field: Field, + min_value: u64, + max_value: u64, + idx: usize) -> io::Result<FastSingleFieldSerializer<CountingWriter<WritePtr>>> { + let field_write = self.composite_write.for_field_with_idx(field, idx); FastSingleFieldSerializer::open(field_write, min_value, max_value) } + /// Closes the serializer /// /// After this call the data must be persistently save on disk. @@ -75,9 +86,9 @@ impl<'a, W: Write> FastSingleFieldSerializer<'a, W> { let num_bits = compute_num_bits(amplitude); let bit_packer = BitPacker::new(num_bits as usize); Ok(FastSingleFieldSerializer { - write, - bit_packer, - min_value, + write: write, + bit_packer: bit_packer, + min_value: min_value, }) } |