pub const FINGERPRINT_SIZE: usize = 1;
pub const BUCKET_SIZE: usize = 4;
pub(crate) const EMPTY_FINGERPRINT: u8 = 100;
#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)]
pub struct Fingerprint {
pub data: [u8; FINGERPRINT_SIZE],
}
impl Fingerprint {
pub fn from_data(data: [u8; FINGERPRINT_SIZE]) -> Option<Self> {
let result = Self { data };
if result.is_empty() {
None
} else {
Some(result)
}
}
pub fn is_empty(&self) -> bool {
self.data == [EMPTY_FINGERPRINT]
}
}