Tracking Issue for CharIndices::offset function · Issue #83871 · rust-lang/rust (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
Feature gate: #![feature(char_indices_offset)]
This is a tracking issue for the function CharIndices::offset
. It returns the byte position of the next character, or the length of the underlying string if there are no more characters. This is useful for getting ranges over strings you're iterating over.
Public API
let mut chars = "a楽".char_indices();
assert_eq!(chars.offset(), 0); assert_eq!(chars.next(), Some((0, 'a')));
assert_eq!(chars.offset(), 1); assert_eq!(chars.next(), Some((1, '楽')));
assert_eq!(chars.offset(), 4); assert_eq!(chars.next(), None);
Steps / History
- Implementation: Added CharIndices::offset function #82585
- Final commenting period (FCP)
- Stabilization PR