rff icon indicating copy to clipboard operation
rff copied to clipboard

Interface::run returns a Cow<'a>

Open seb-bl opened this issue 5 years ago • 0 comments

I recently used this crate as a lib for a personal project, and I really appreciated it!

I once tried to simply call Interface::new(&stuff).run() and got errors with lifetime. Looking further I found out that the result of run is not a reference with the lifetime of stuff, because it may return a reference to the search string.

So I changed the return type of run and the function result to take the search string in the case of no matches. This allows dropping Interface and keep the result.

This is a breaking change to the API, as the return type and lifetime are changed, and run now clear the search string if it did not match.

seb-bl avatar May 10 '20 09:05 seb-bl