pub fn charref(s: &str, pos: usize) -> Option<char>Expand description
Port of wchar_t charref(char *x, char *y, int *zmb_ind) from
Src/pattern.c:1909. Decode the char at pos without
advancing. UTF-32-native delegation: s.chars().next() returns
the decoded codepoint; delegates to Rust’s native UTF-8 string
iterator instead of the C Meta-decode + zshtoken-translate +
mbrtowc state machine, which all collapse because Rust’s &str
is already UTF-8.
Rust signature differs from C charref(char *x, char *y, int *zmb_ind):
the C y end-of-string pointer is captured by &str length; the
zmb_ind out-param (multibyte-completion index) is dropped — the
Rust UTF-8 decode is one-shot, never partial.