@@ -8,7 +8,7 @@ use crate::rust::cursor::IncrementCursor;
88use crate :: { FastPForError , FastPForResult } ;
99
1010/// Variable-byte encoding codec for integer compression.
11- #[ derive( Debug ) ]
11+ #[ derive( Debug , Default ) ]
1212pub struct VariableByte ;
1313
1414// Helper functions with const generics for extracting 7-bit chunks
@@ -28,8 +28,8 @@ impl VariableByte {
2828impl VariableByte {
2929 /// Creates a new instance
3030 #[ must_use]
31- pub fn new ( ) -> VariableByte {
32- VariableByte
31+ pub fn new ( ) -> Self {
32+ Self
3333 }
3434
3535 /// Compress `input_length` u32 values from `input[input_offset..]` into
@@ -301,20 +301,14 @@ impl VariableByte {
301301 }
302302}
303303
304- impl Default for VariableByte {
305- fn default ( ) -> Self {
306- VariableByte :: new ( )
307- }
308- }
309-
310304impl AnyLenCodec for VariableByte {
311305 fn encode ( & mut self , input : & [ u32 ] , out : & mut Vec < u32 > ) -> FastPForResult < ( ) > {
312306 let capacity = input. len ( ) * 2 + 4 ;
313307 let start = out. len ( ) ;
314308 out. resize ( start + capacity, 0 ) ;
315309 let mut in_off = Cursor :: new ( 0u32 ) ;
316310 let mut out_off = Cursor :: new ( 0u32 ) ;
317- VariableByte :: compress_into_slice (
311+ Self :: compress_into_slice (
318312 input,
319313 input. len ( ) as u32 ,
320314 & mut in_off,
@@ -342,7 +336,7 @@ impl AnyLenCodec for VariableByte {
342336 out. resize ( start + capacity, 0 ) ;
343337 let mut in_off = Cursor :: new ( 0u32 ) ;
344338 let mut out_off = Cursor :: new ( 0u32 ) ;
345- VariableByte :: decompress_from_u32_slice (
339+ Self :: decompress_from_u32_slice (
346340 input,
347341 input. len ( ) as u32 ,
348342 & mut in_off,
0 commit comments