1
1
use std:: io:: { self , Write } ;
2
2
3
- use common:: CountingWriter ;
4
3
pub use fastfield_codecs:: { Column , FastFieldStats } ;
5
4
use fastfield_codecs:: { FastFieldCodecType , MonotonicallyMappableToU64 , ALL_CODEC_TYPES } ;
6
5
@@ -71,15 +70,13 @@ impl CompositeFastFieldSerializer {
71
70
Ok ( ( ) )
72
71
}
73
72
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.
75
76
///
76
77
/// 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 )
83
80
}
84
81
85
82
/// Closes the serializer
@@ -89,17 +86,3 @@ impl CompositeFastFieldSerializer {
89
86
self . composite_write . close ( )
90
87
}
91
88
}
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
- }
0 commit comments