Macro const_str::ends_with

source ·
macro_rules! ends_with {
    ($haystack: expr, $pattern: expr) => { ... };
}
Expand description

Returns true if the given pattern matches a suffix of this string slice.

Returns false if it does not.

The pattern type must be one of

§Examples

const BANANAS: &str = "bananas";
const A: bool = const_str::ends_with!(BANANAS, "anas");
const B: bool = const_str::ends_with!(BANANAS, "nana");
const C: bool = const_str::ends_with!(BANANAS, 's');
assert_eq!([A, B, C], [true, false, true]);