BytesPattern from tupple

This commit is contained in:
Dmitry Belyaev 2022-08-27 22:48:10 +03:00
parent 90576774fd
commit 3deb961413
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3

View File

@ -57,11 +57,19 @@ impl From<&str> for BytesPattern {
} }
} }
let mut s = Self { let bytes = HEXUPPER
bytes: HEXUPPER
.decode(elements.join("").as_bytes()) .decode(elements.join("").as_bytes())
.expect("decode pattern"), .expect("decode pattern");
mask,
Self::from((bytes, mask))
}
}
impl From<(Vec<u8>, Vec<bool>)> for BytesPattern {
fn from(x: (Vec<u8>, Vec<bool>)) -> Self {
let mut s = Self {
bytes: x.0,
mask: x.1,
pi: Vec::<usize>::new(), pi: Vec::<usize>::new(),
}; };
s.prefix_function(); s.prefix_function();