Skip to main content

ends_with_mode_suffix

Function ends_with_mode_suffix 

Source
pub const fn ends_with_mode_suffix(s: &str) -> bool
Expand description

const fn byte-walk: returns true iff s ends in the literal suffix -mode. Used by the groups! macro to assert the disambiguation invariant at compile time.

Returns false for strings shorter than the suffix. Implementation walks bytes from the end – ASCII-safe because mode/group names are constrained to lowercase letters, digits, and hyphens.

§Examples

use lattice_config::ends_with_mode_suffix;

assert!(ends_with_mode_suffix("rust-mode"));
assert!(!ends_with_mode_suffix("editor"));
assert!(!ends_with_mode_suffix("mode")); // no leading hyphen