Contents

reset(toUnchecked:)

Reset this iterator to codeUnitOffset, skipping all safety checks.

Declaration

mutating func reset(toUnchecked codeUnitOffset: Int)

Discussion

Note: This is only for very specific, low-level use cases. If codeUnitOffset is not properly scalar-aligned, this function can result in undefined behavior when, e.g., next() is called.

If i is scalar-aligned, but not Character-aligned, you may get different results from running Character iteration.

For example, this could be used by a regex engine to backtrack to a known-valid previous position.