mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
stage: moving performance enhancements into main
several incomplete features are gated behind the `experimental_features` flag.
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
|
||||
// import java.io.ByteArrayOutputStream;
|
||||
|
||||
use std::io::Write;
|
||||
|
||||
/**
|
||||
* Class that lets one easily build an array of bytes by appending bits at a time.
|
||||
*
|
||||
@@ -71,3 +73,19 @@ impl Default for BitSourceBuilder {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Write for BitSourceBuilder {
|
||||
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
let mut written = 0;
|
||||
for byte in buf.iter() {
|
||||
self.write(*byte as u32, 8);
|
||||
written += 1;
|
||||
}
|
||||
|
||||
Ok(written)
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> std::io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user