Skip to content

Tracking Issue for CharIndices::offset function #83871

Closed
@TrolledWoods

Description

@TrolledWoods

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

Unresolved Questions

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions