devela::_dep::const_str

Macro sorted

macro_rules! sorted {
    ($s:expr) => { ... };
}
Available on crate feature dep_const_str only.
Expand description

Sorts string slices and returns a new array.

The input type must be one of:

ยงExamples

const SORTED1: &[&str] = &const_str::sorted!(["one", "two", "three"]);
assert_eq!(SORTED1, &["one", "three", "two"]);

const SORTED2: [&str; 3] = const_str::sorted!(["1", "2", "10"]);
assert_eq!(SORTED2, ["1", "10", "2"]);