Skip to content

Commit

Permalink
Add MustReadFrom with panic
Browse files Browse the repository at this point in the history
  • Loading branch information
bstrausser committed May 2, 2024
1 parent 7ba3ee0 commit 261b860
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions roaring.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ func (rb *Bitmap) ReadFrom(reader io.Reader, cookieHeader ...byte) (p int64, err
return
}

func (rb *Bitmap) MustReadFrom(reader io.Reader, cookieHeader ...byte) (p int64, err error) {
rb.ReadFrom(reader, cookieHeader...)
if err := rb.Validate(); err != nil {
panic(err)
}
return
}

// FromBuffer creates a bitmap from its serialized version stored in buffer
//
// The format specification is available here:
Expand Down

0 comments on commit 261b860

Please sign in to comment.