mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-02-22 02:25:32 +08:00
Call the serialize_into_writer method from the serialize_into one
This commit is contained in:
parent
14ee7aa84c
commit
13f21206a6
@ -27,18 +27,8 @@ impl CboRoaringBitmapCodec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn serialize_into(roaring: &RoaringBitmap, vec: &mut Vec<u8>) {
|
pub fn serialize_into_vec(roaring: &RoaringBitmap, vec: &mut Vec<u8>) {
|
||||||
if roaring.len() <= THRESHOLD as u64 {
|
Self::serialize_into_writer(roaring, vec).unwrap()
|
||||||
// If the number of items (u32s) to encode is less than or equal to the threshold
|
|
||||||
// it means that it would weigh the same or less than the RoaringBitmap
|
|
||||||
// header, so we directly encode them using ByteOrder instead.
|
|
||||||
for integer in roaring {
|
|
||||||
vec.write_u32::<NativeEndian>(integer).unwrap();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Otherwise, we use the classic RoaringBitmapCodec that writes a header.
|
|
||||||
roaring.serialize_into(vec).unwrap();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn serialize_into_writer<W: io::Write>(
|
pub fn serialize_into_writer<W: io::Write>(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user