Skip to content

Instantly share code, notes, and snippets.

@Tarmil
Created April 26, 2020 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tarmil/daff5a300c2b1b9b63d6a6569f732d8f to your computer and use it in GitHub Desktop.
Save Tarmil/daff5a300c2b1b9b63d6a6569f732d8f to your computer and use it in GitHub Desktop.
namespace Avalonia.Media.TextFormatting.Unicode
open Avalonia.Utility
[<Struct; IsByRefLike>]
type CodepointEnumerator(text: ReadOnlySlice<char>) =
let mutable text = text
let mutable current = Codepoint.ReplacementCodepoint
member _.Current = current
member _.MoveNext() =
if text.IsEmpty then
current <- Codepoint.ReplacementCodepoint
false
else
let current', count = Codepoint.ReadAt(text, 0)
current <- current'
text <- text.Skip(count)
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment