Allow the retrieval of the stored pattern as a &str

This commit is contained in:
delta 2022-11-21 15:14:48 -06:00
parent de5d217ddf
commit 42a6b4534f

View file

@ -79,6 +79,10 @@ impl <'a> LuaPattern<'a> {
LuaPattern::from_bytes_try(bytes).expect("bad pattern")
}
pub fn as_str(self) -> &'a str {
&String::from_utf8_lossy(self.patt)
}
/// Match a slice of bytes with a pattern
///
/// ```