Skip to content

Commit edd9155

Browse files
committed
return Write, add documentation
1 parent 29d5611 commit edd9155

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

src/fastfield/bytes/writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::io;
1+
use std::io::{self, Write};
22

33
use fastfield_codecs::VecColumn;
44

src/fastfield/serializer/mod.rs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::io::{self, Write};
22

3-
use common::CountingWriter;
43
pub use fastfield_codecs::{Column, FastFieldStats};
54
use fastfield_codecs::{FastFieldCodecType, MonotonicallyMappableToU64, ALL_CODEC_TYPES};
65

@@ -71,15 +70,13 @@ impl CompositeFastFieldSerializer {
7170
Ok(())
7271
}
7372

74-
/// Start serializing a new [u8] fast field.
73+
/// Start serializing a new [u8] fast field. Use the returned writer to write data into the
74+
/// bytes field. To associate the bytes with documents a seperate index must be created on
75+
/// index 0. See bytes/writer.rs::serialize for an example.
7576
///
7677
/// The bytes will be stored as is, no compression will be applied.
77-
pub fn new_bytes_fast_field(
78-
&mut self,
79-
field: Field,
80-
) -> FastBytesFieldSerializer<'_, CountingWriter<WritePtr>> {
81-
let field_write = self.composite_write.for_field_with_idx(field, 1);
82-
FastBytesFieldSerializer { write: field_write }
78+
pub fn new_bytes_fast_field(&mut self, field: Field) -> impl Write + '_ {
79+
self.composite_write.for_field_with_idx(field, 1)
8380
}
8481

8582
/// Closes the serializer
@@ -89,17 +86,3 @@ impl CompositeFastFieldSerializer {
8986
self.composite_write.close()
9087
}
9188
}
92-
93-
pub struct FastBytesFieldSerializer<'a, W: Write> {
94-
write: &'a mut W,
95-
}
96-
97-
impl<'a, W: Write> FastBytesFieldSerializer<'a, W> {
98-
pub fn write_all(&mut self, vals: &[u8]) -> io::Result<()> {
99-
self.write.write_all(vals)
100-
}
101-
102-
pub fn flush(&mut self) -> io::Result<()> {
103-
self.write.flush()
104-
}
105-
}

src/indexer/merger.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::cmp;
22
use std::collections::HashMap;
3+
use std::io::Write;
34
use std::sync::Arc;
45

56
use fastfield_codecs::VecColumn;

0 commit comments

Comments
 (0)