diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 0b77b95..839cd2e 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -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, Vec)> for BytesPattern { + fn from(x: (Vec, Vec)) -> Self { let mut s = Self { - bytes: HEXUPPER - .decode(elements.join("").as_bytes()) - .expect("decode pattern"), - mask, + bytes: x.0, + mask: x.1, pi: Vec::::new(), }; s.prefix_function();