diff --git a/src/lib.rs b/src/lib.rs index f72ff50..59d3726 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,11 +46,11 @@ impl Corrections { Corrections { } } - pub fn correct_str(&self, word: &str) -> Option<&str> { + pub fn correct_str<'s>(&'s self, word: &str) -> Option<&'s str> { DICTIONARY.get(word).map(|s| *s) } - pub fn correct_bytes(&self, word: &[u8]) -> Option<&[u8]> { + pub fn correct_bytes<'s>(&'s self, word: &[u8]) -> Option<&'s [u8]> { std::str::from_utf8(word).ok().and_then(|word| DICTIONARY.get(word)).map(|s| s.as_bytes()) } }