aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2024-08-02 16:02:46 +0100
committerAkshay <[email protected]>2024-08-02 16:02:46 +0100
commit1ee4d04b394dafebb82c72ebb57f3affe04c9584 (patch)
tree05e662268b87b0929841d1ce983c16d72d3d974e
parent7773bfb4c63ab3ea49b428e20ef0946b713fd5f5 (diff)
fixes for bitvec 1.0 releaseHEADmaster
-rw-r--r--Cargo.toml2
-rw-r--r--src/decode.rs4
-rw-r--r--src/encode.rs2
-rw-r--r--src/lib.rs2
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"
13 13
14[dependencies] 14[dependencies]
15byteorder = "1.4.2" 15byteorder = "1.4.2"
16bitvec = "0.21.0" 16bitvec = "1"
17sdl2 = { version = "0.34", optional = true } 17sdl2 = { version = "0.34", optional = true }
18png = { version = "0.16", optional = true } 18png = { version = "0.16", optional = true }
19 19
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<Vec<u8>>) -> OBIResult<Image> {
61 .map_err(|_| OBIError::Decode)?; 61 .map_err(|_| OBIError::Decode)?;
62 rest.iter() 62 rest.iter()
63 .map(|&b| { 63 .map(|&b| {
64 BitVec::<Lsb0, u8>::from_element(b) 64 BitVec::<u8>::from_element(b)
65 .into_iter() 65 .into_iter()
66 .map(|e| e as bool) 66 .map(|e| e as bool)
67 .collect::<Vec<bool>>() 67 .collect::<Vec<bool>>()
@@ -80,7 +80,7 @@ pub fn decode_image(obi_data: &mut Cursor<Vec<u8>>) -> OBIResult<Image> {
80 .map_err(|_| OBIError::Decode)?; 80 .map_err(|_| OBIError::Decode)?;
81 rest.iter() 81 rest.iter()
82 .map(|&b| { 82 .map(|&b| {
83 BitVec::<Lsb0, u8>::from_element(b) 83 BitVec::<u8>::from_element(b)
84 .into_iter() 84 .into_iter()
85 .map(|e| e as bool) 85 .map(|e| e as bool)
86 .collect::<Vec<bool>>() 86 .collect::<Vec<bool>>()
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
45 45
46 let write_pixel_data = |pixels: &Vec<bool>, obi_data: &mut Vec<u8>| -> OBIResult<()> { 46 let write_pixel_data = |pixels: &Vec<bool>, obi_data: &mut Vec<u8>| -> OBIResult<()> {
47 for byte in pixels.chunks(8) { 47 for byte in pixels.chunks(8) {
48 let mut bv = BitVec::<Lsb0, u8>::new(); 48 let mut bv = BitVec::<u8>::new();
49 for &b in byte { 49 for &b in byte {
50 bv.push(b) 50 bv.push(b)
51 } 51 }
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 @@
4 4
5use std::io; 5use std::io;
6 6
7#[cfg(feature = "png")]
7pub mod convert; 8pub mod convert;
8mod decode; 9mod decode;
9mod encode; 10mod encode;
@@ -167,6 +168,7 @@ impl Image {
167 decode::decode_image(data) 168 decode::decode_image(data)
168 } 169 }
169 170
171 #[cfg(feature = "png")]
170 pub fn write_png<W: io::Write>(&self, writer: W) -> png::Writer<W> { 172 pub fn write_png<W: io::Write>(&self, writer: W) -> png::Writer<W> {
171 convert::to_png(writer, self) 173 convert::to_png(writer, self)
172 } 174 }