Allow the use of regular expressions or strings wherever you need string comparison.
Examples
Using Generics / Monomorphization
This pattern is faster but generates more code, slightly larger binary.
If you don't have a preference, go with this option as the code is usually more convenient to write.
And now all of the following will work:
accept_needle;
accept_needle;
accept_needle;
accept_needle;
For string comparisons you can also use StringMatch
which allows you to be more explicit about the comparison:
accept_needle;
accept_needle;
By default StringMatch
matches the whole string and is case sensitive (safety by default).
And finally there is the StringMatchable
trait that is implemented for String
and &str
:
accept_needle;
accept_needle;
Using Dynamic Dispatch
This pattern is slightly slower but generates less code, slightly smaller binary.
And now all of the following will work:
accept_needle;
accept_needle;
accept_needle;
accept_needle;
accept_needle;
accept_needle;
LICENSE
This work is licensed under MIT.
SPDX-License-Identifier: MIT