Implement Eq and Clone for bool bitfield
This commit is contained in:
parent
96fe99f8fa
commit
52b4f86eee
@ -10,6 +10,7 @@ extern crate rlp;
|
||||
use std::cmp::max;
|
||||
use self::rlp::{ RlpStream, Encodable };
|
||||
|
||||
#[derive(Eq)]
|
||||
pub struct BooleanBitfield{
|
||||
len: usize,
|
||||
vec: Vec<u8>
|
||||
@ -82,6 +83,23 @@ impl BooleanBitfield {
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for BooleanBitfield {
|
||||
fn eq(&self, other: &BooleanBitfield) -> bool {
|
||||
(self.vec == other.vec) &
|
||||
(self.len == other.len)
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for BooleanBitfield {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
vec: self.vec.to_vec(),
|
||||
..*self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl Encodable for BooleanBitfield {
|
||||
// TODO: ensure this is a sensible method of encoding
|
||||
// the bitfield. Currently, it is treated as a list of
|
||||
|
Loading…
Reference in New Issue
Block a user