Documentation

UnicodeFormat.Iterator.UTF32

UTF-32 iterators #

UTF32.decodeIter reads characters from UTF-32 code units, and UTF32.encodeIter writes them back. A code unit that is a surrogate or above U+10FFFF is ill-formed.

structure Unicode.UTF32 :

The UTF-32 encoding form, as a decoder from code units and an encoder to code units.

    Instances For
      @[inline]
      def Unicode.UTF32.decodeChar {ι : Type} [Std.Iterator ι Id UInt32] [Std.Iterators.Productive ι Id] {β : Type} (it : Std.Iter UInt32) (yield : (rest : Std.Iter UInt32) → Advanced rest it → Char → β) (error : DecodeError.Kind → (rest : Std.Iter UInt32) → Advanced rest it → β) (done : Unit → β) :
      β

      Decodes one character from the UTF-32 code units of it. Calls yield with the character and the iterator after it, error with the iterator after a code unit that is not a scalar value, or done at the end of the input.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        @[instance_reducible]
        Equations
        • One or more equations did not get rendered due to their size.
        @[instance_reducible]
        Equations
        @[inline]

        Decodes the UTF-32 code units of it, stopping at the first that is not a scalar value.

        A for loop or fold over the result ends at ill-formed input just as at the end of the input. To tell them apart, fold with decodeFold, which also returns the iterator where decoding stopped, and check decodeError? there, find the first ill-formed input ahead with decodeFailure?, or decode with decodeIterLossy instead.

        Equations
        Instances For
          @[inline]

          Decodes the UTF-32 code units of it, replacing each that is not a scalar value with U+FFFD.

          Equations
          Instances For
            @[inline]

            Encodes the characters of it as UTF-32 code units.

            Equations
            Instances For