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

impl BitRead for Box

This commit is contained in:
Robin Appelman 2019-10-11 20:26:00 +02:00
commit ddada03f34

View file

@ -238,6 +238,13 @@ impl<E: Endianness, T: BitRead<E>> BitRead<E> for Arc<T> {
} }
} }
impl<E: Endianness, T: BitRead<E>> BitRead<E> for Box<T> {
#[inline]
fn read(stream: &mut BitStream<E>) -> Result<Self> {
Ok(Box::new(T::read(stream)?))
}
}
/// Trait for types that can be read from a stream, requiring the size to be configured /// Trait for types that can be read from a stream, requiring the size to be configured
/// ///
/// The meaning of the set sized depends on the type being read (e.g, number of bits for integers, /// The meaning of the set sized depends on the type being read (e.g, number of bits for integers,