fix vec len, add moving transparent line example
This commit is contained in:
parent
02bac1e173
commit
35ae1f20ce
5 changed files with 81 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/// A vector of bits
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone)]
|
||||
pub struct BitVec {
|
||||
data: Vec<u8>,
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ impl BitVec {
|
|||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.data.len()
|
||||
self.data.len() * 8
|
||||
}
|
||||
|
||||
fn get_indexes(&self, index: usize) -> (usize, u8) {
|
||||
|
@ -56,3 +56,12 @@ impl Into<Vec<u8>> for BitVec {
|
|||
self.data
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for BitVec {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fmt.debug_struct("BitVec")
|
||||
.field("len", &self.len())
|
||||
.field("data", &self.data)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue