From 1ee4d04b394dafebb82c72ebb57f3affe04c9584 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 2 Aug 2024 16:02:46 +0100 Subject: fixes for bitvec 1.0 release --- Cargo.toml | 2 +- src/decode.rs | 4 ++-- src/encode.rs | 2 +- src/lib.rs | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0f8e5f1..0685249 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ license = "MIT" [dependencies] byteorder = "1.4.2" -bitvec = "0.21.0" +bitvec = "1" sdl2 = { version = "0.34", optional = true } png = { version = "0.16", optional = true } diff --git a/src/decode.rs b/src/decode.rs index 2202116..3738b2e 100644 --- a/src/decode.rs +++ b/src/decode.rs @@ -61,7 +61,7 @@ pub fn decode_image(obi_data: &mut Cursor>) -> OBIResult { .map_err(|_| OBIError::Decode)?; rest.iter() .map(|&b| { - BitVec::::from_element(b) + BitVec::::from_element(b) .into_iter() .map(|e| e as bool) .collect::>() @@ -80,7 +80,7 @@ pub fn decode_image(obi_data: &mut Cursor>) -> OBIResult { .map_err(|_| OBIError::Decode)?; rest.iter() .map(|&b| { - BitVec::::from_element(b) + BitVec::::from_element(b) .into_iter() .map(|e| e as bool) .collect::>() diff --git a/src/encode.rs b/src/encode.rs index e52b69b..58c455e 100644 --- a/src/encode.rs +++ b/src/encode.rs @@ -45,7 +45,7 @@ where let write_pixel_data = |pixels: &Vec, obi_data: &mut Vec| -> OBIResult<()> { for byte in pixels.chunks(8) { - let mut bv = BitVec::::new(); + let mut bv = BitVec::::new(); for &b in byte { bv.push(b) } diff --git a/src/lib.rs b/src/lib.rs index b6cab75..3366cda 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,6 +4,7 @@ use std::io; +#[cfg(feature = "png")] pub mod convert; mod decode; mod encode; @@ -167,6 +168,7 @@ impl Image { decode::decode_image(data) } + #[cfg(feature = "png")] pub fn write_png(&self, writer: W) -> png::Writer { convert::to_png(writer, self) } -- cgit v1.2.3