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

add bitwrite for vec

This commit is contained in:
Robin Appelman 2021-07-18 15:06:25 +02:00
commit ceea28d500
2 changed files with 11 additions and 1 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "bitbuffer"
version = "0.9.3"
version = "0.9.4"
authors = ["Robin Appelman <robin@icewind.nl>"]
edition = "2018"
description = "Reading bit sequences from a byte slice"

View file

@ -179,6 +179,16 @@ impl<T: BitWrite<E>, E: Endianness> BitWrite<E> for Arc<T> {
}
}
impl<T: BitWrite<E>, E: Endianness> BitWrite<E> for Vec<T> {
#[inline]
fn write(&self, stream: &mut BitWriteStream<E>) -> Result<()> {
for item in self {
stream.write(item)?;
}
Ok(())
}
}
macro_rules! impl_write_tuple {
($($i:tt: $type:ident),*) => {
impl<'a, E: Endianness, $($type: BitWrite<E>),*> BitWrite<E> for ($($type),*) {