From 42a6b4534ffcfb97a05685fb662ef6aaecfad38a Mon Sep 17 00:00:00 2001 From: delta Date: Mon, 21 Nov 2022 15:14:48 -0600 Subject: [PATCH] Allow the retrieval of the stored pattern as a &str --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 06ba3c7..08aff6e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 /// /// ```