konst::string

Function chars

Source
pub const fn chars(string: &str) -> Chars<'_>
Expand description

Cosnt equivalent of str::chars.

ยงExample

use konst::string;
use konst::iter::collect_const;

const CHARS: &[char] = &collect_const!(char => string::chars("bar"));
const REV: &[char] = &collect_const!(char => string::chars("bar").rev());

assert_eq!(CHARS, &['b', 'a', 'r']);
assert_eq!(REV, &['r', 'a', 'b']);