devela::_dep::const_str

Macro ends_with

macro_rules! ends_with {
    ($haystack: expr, $pattern: expr) => { ... };
}
Available on crate feature dep_const_str only.
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]);