@@ -413,12 +413,6 @@ impl Iterator for SignedDeltaRun {
413413 }
414414}
415415
416- pub enum IteratorEnum < I , II , III > {
417- Direct ( I ) ,
418- Delta ( II ) ,
419- ShortRepeat ( III ) ,
420- }
421-
422416#[ inline]
423417fn run_encoding ( header : u8 ) -> EncodingTypeV2 {
424418 match ( header & 128 == 128 , header & 64 == 64 ) {
@@ -433,13 +427,18 @@ fn run_encoding(header: u8) -> EncodingTypeV2 {
433427 }
434428}
435429
430+ /// An enum describing one of the RLE v2 runs for unsigned integers
436431pub enum UnsignedRleV2Run {
432+ /// Direct
437433 Direct ( UnsignedDirectRun ) ,
434+ /// Delta
438435 Delta ( UnsignedDeltaRun ) ,
436+ /// Short repeat
439437 ShortRepeat ( UnsignedShortRepeat ) ,
440438}
441439
442440impl UnsignedRleV2Run {
441+ /// Returns a new [`UnsignedRleV2Run`] owning `scratch`.
443442 pub fn try_new < R : Read > ( reader : & mut R , scratch : Vec < u8 > ) -> Result < Self , Error > {
444443 let mut header = [ 0u8 ] ;
445444 reader. read_exact ( & mut header) ?;
@@ -460,6 +459,7 @@ impl UnsignedRleV2Run {
460459 }
461460 }
462461
462+ /// The number of items remaining
463463 pub fn len ( & self ) -> usize {
464464 match self {
465465 Self :: Direct ( run) => run. len ( ) ,
@@ -468,19 +468,22 @@ impl UnsignedRleV2Run {
468468 }
469469 }
470470
471+ /// Whether the iterator is empty
471472 #[ must_use]
472473 pub fn is_empty ( & self ) -> bool {
473474 self . len ( ) == 0
474475 }
475476}
476477
478+ /// A fallible [`Iterator`] of [`UnsignedRleV2Run`].
477479pub struct UnsignedRleV2Iter < ' a , R : Read > {
478480 reader : & ' a mut R ,
479481 scratch : Vec < u8 > ,
480482 length : usize ,
481483}
482484
483485impl < ' a , R : Read > UnsignedRleV2Iter < ' a , R > {
486+ /// Returns a new [`UnsignedRleV2Iter`].
484487 pub fn new ( reader : & ' a mut R , length : usize , scratch : Vec < u8 > ) -> Self {
485488 Self {
486489 reader,
@@ -514,6 +517,7 @@ impl SignedDirectRun {
514517 self . 0 . len ( )
515518 }
516519
520+ /// Whether the iterator is empty
517521 #[ must_use]
518522 pub fn is_empty ( & self ) -> bool {
519523 self . len ( ) == 0
@@ -540,10 +544,12 @@ impl SignedShortRepeat {
540544 UnsignedShortRepeat :: try_new ( header, reader, scratch) . map ( Self )
541545 }
542546
547+ /// The number of items remaining
543548 pub fn len ( & self ) -> usize {
544549 self . 0 . len ( )
545550 }
546551
552+ /// Whether the iterator is empty
547553 #[ must_use]
548554 pub fn is_empty ( & self ) -> bool {
549555 self . len ( ) == 0
@@ -562,14 +568,19 @@ impl Iterator for SignedShortRepeat {
562568 }
563569}
564570
571+ /// An enum describing one of the RLE v2 runs for signed integers
565572#[ derive( Debug ) ]
566573pub enum SignedRleV2Run {
574+ /// Direct
567575 Direct ( SignedDirectRun ) ,
576+ /// Delta
568577 Delta ( SignedDeltaRun ) ,
578+ /// Short repeat
569579 ShortRepeat ( SignedShortRepeat ) ,
570580}
571581
572582impl SignedRleV2Run {
583+ /// Returns a new [`SignedRleV2Run`], moving `scratch` to itself
573584 pub fn try_new < R : Read > ( reader : & mut R , scratch : Vec < u8 > ) -> Result < Self , Error > {
574585 let mut header = [ 0u8 ] ;
575586 reader. read_exact ( & mut header) ?;
@@ -590,6 +601,7 @@ impl SignedRleV2Run {
590601 }
591602 }
592603
604+ /// The number of items remaining
593605 pub fn len ( & self ) -> usize {
594606 match self {
595607 Self :: Direct ( run) => run. len ( ) ,
@@ -598,19 +610,22 @@ impl SignedRleV2Run {
598610 }
599611 }
600612
613+ /// Whether the iterator is empty
601614 #[ must_use]
602615 pub fn is_empty ( & self ) -> bool {
603616 self . len ( ) == 0
604617 }
605618}
606619
620+ /// A fallible [`Iterator`] of [`SignedRleV2Run`].
607621pub struct SignedRleV2Iter < R : Read > {
608622 reader : R ,
609623 scratch : Vec < u8 > ,
610624 length : usize ,
611625}
612626
613627impl < R : Read > SignedRleV2Iter < R > {
628+ /// Returns a new [`SignedRleV2Iter`].
614629 pub fn new ( reader : R , length : usize , scratch : Vec < u8 > ) -> Self {
615630 Self {
616631 reader,
0 commit comments