aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
parent7773bfb4c63ab3ea49b428e20ef0946b713fd5f5 (diff)
fixes for bitvec 1.0 releaseHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/decode.rs4
-rw-r--r--src/encode.rs2
-rw-r--r--src/lib.rs2
3 files changed, 5 insertions, 3 deletions
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 }