Skip to content

Commit

Permalink
Add into_bits convenience method for UperReader (#82)
Browse files Browse the repository at this point in the history
`UperReader`s can be created from any type implementing `ScopedBitRead`.
However, `UperReader::from` obviously consumes this type.  Users of
`UperReader` may want to get the original `ScopedBitReader` back out
after they are done with the `UperReader`.  This patch provides an
`into_bits` function which returns the underlying `ScopedBitRead` type,
consuming the `UperReader`.
  • Loading branch information
jkalez authored Aug 16, 2023
1 parent 398b6cb commit e8b7c3c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/syn/io/uper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,11 @@ impl<'a> From<(&'a [u8], usize)> for UperReader<Bits<'a>> {
}

impl<B: ScopedBitRead> UperReader<B> {
#[inline]
pub fn into_bits(self) -> B {
self.bits
}

#[inline]
fn read_length_determinant(
&mut self,
Expand Down

0 comments on commit e8b7c3c

Please sign in to comment.