File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -297,11 +297,24 @@ impl BooleanBufferBuilder {
297
297
Self { buffer, len : 0 }
298
298
}
299
299
300
+ #[ inline]
301
+ pub fn new_from_buffer ( buffer : MutableBuffer , len : usize ) -> BooleanBufferBuilder {
302
+ assert_eq ! ( len. div_ceil( 8 ) , buffer. len( ) ) ;
303
+ Self { buffer, len }
304
+ }
305
+
300
306
#[ inline]
301
307
pub fn len ( & self ) -> usize {
302
308
self . len
303
309
}
304
310
311
+ // TODO: Remove, and don't use the elem-by-elem peek_evaluate function.
312
+ #[ inline]
313
+ pub fn get_bit ( & self , index : usize ) -> bool {
314
+ bit_util:: get_bit ( self . buffer . as_ref ( ) , index)
315
+ }
316
+
317
+ // TODO: Probably, make set_bit be branchless
305
318
#[ inline]
306
319
pub fn set_bit ( & mut self , index : usize , v : bool ) {
307
320
if v {
@@ -382,6 +395,12 @@ impl BooleanBufferBuilder {
382
395
self . len = 0 ;
383
396
buf. into ( )
384
397
}
398
+
399
+ #[ inline]
400
+ /// Builds the [Buffer] without resetting the builder.
401
+ pub fn finish_cloned ( & self ) -> Buffer {
402
+ Buffer :: from_slice_ref ( & self . buffer . as_slice ( ) )
403
+ }
385
404
}
386
405
387
406
impl From < BooleanBufferBuilder > for Buffer {
You can’t perform that action at this time.
0 commit comments