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 bytes = HEXUPPER
.decode(elements.join("").as_bytes())
.expect("decode pattern");
Self::from((bytes, mask))
}
}
impl From<(Vec<u8>, Vec<bool>)> for BytesPattern {
fn from(x: (Vec<u8>, Vec<bool>)) -> Self {
let mut s = Self { let mut s = Self {
bytes: HEXUPPER bytes: x.0,
.decode(elements.join("").as_bytes()) mask: x.1,
.expect("decode pattern"),
mask,
pi: Vec::<usize>::new(), pi: Vec::<usize>::new(),
}; };
s.prefix_function(); s.prefix_function();