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:
parent
9eb4c0a05c
commit
ceea28d500
2 changed files with 11 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "bitbuffer"
|
name = "bitbuffer"
|
||||||
version = "0.9.3"
|
version = "0.9.4"
|
||||||
authors = ["Robin Appelman <robin@icewind.nl>"]
|
authors = ["Robin Appelman <robin@icewind.nl>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Reading bit sequences from a byte slice"
|
description = "Reading bit sequences from a byte slice"
|
||||||
|
|
|
||||||
10
src/write.rs
10
src/write.rs
|
|
@ -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 {
|
macro_rules! impl_write_tuple {
|
||||||
($($i:tt: $type:ident),*) => {
|
($($i:tt: $type:ident),*) => {
|
||||||
impl<'a, E: Endianness, $($type: BitWrite<E>),*> BitWrite<E> for ($($type),*) {
|
impl<'a, E: Endianness, $($type: BitWrite<E>),*> BitWrite<E> for ($($type),*) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue