1
0
Fork 0
mirror of https://codeberg.org/icewind/bitbuffer.git synced 2026-06-03 16:44:06 +02:00

derive unchecked methods for traits

This commit is contained in:
Robin Appelman 2020-01-07 22:36:37 +01:00
commit a6e9b59ece
2 changed files with 39 additions and 13 deletions

View file

@ -92,6 +92,9 @@ pub trait BitRead<E: Endianness>: Sized {
/// Read the type from stream
fn read(stream: &mut BitStream<E>) -> Result<Self>;
/// Note: only the bounds are unchecked
///
/// any other validations (e.g. checking for valid utf8) still needs to be done
#[doc(hidden)]
unsafe fn read_unchecked(stream: &mut BitStream<E>) -> Result<Self> {
Self::read(stream)