Documentation

Init.Data.ByteArray.Basic

structure ByteArray :
Instances For
    @[extern lean_mk_empty_byte_array]
    Equations
    Instances For
      @[extern lean_byte_array_push]
      Equations
      Instances For
        @[extern lean_byte_array_size]
        Equations
        Instances For
          @[extern lean_byte_array_uget]
          Equations
          • ByteArray.uget x✝¹ x✝ x = match x✝¹, x✝, x with | { data := bs }, i, h => bs[i]
          Instances For
            @[extern lean_byte_array_get]
            Equations
            Instances For
              @[extern lean_byte_array_fget]
              Equations
              Instances For
                @[extern lean_byte_array_set]
                Equations
                Instances For
                  @[extern lean_byte_array_fset]
                  Equations
                  Instances For
                    @[extern lean_byte_array_uset]
                    Equations
                    • ByteArray.uset x✝² x✝¹ x✝ x = match x✝², x✝¹, x✝, x with | { data := bs }, i, v, h => { data := Array.uset bs i v h }
                    Instances For
                      @[extern lean_byte_array_hash]
                      @[extern lean_byte_array_copy_slice]
                      def ByteArray.copySlice (src : ByteArray) (srcOff : Nat) (dest : ByteArray) (destOff : Nat) (len : Nat) (exact : optParam Bool true) :

                      Copy the slice at [srcOff, srcOff + len) in src to [destOff, destOff + len) in dest, growing dest if necessary. If exact is false, the capacity will be doubled when grown.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        Equations
                        Instances For
                          partial def ByteArray.toList.loop (bs : ByteArray) (i : Nat) (r : List UInt8) :
                          @[inline]
                          def ByteArray.findIdx? (a : ByteArray) (p : UInt8Bool) (start : optParam Nat 0) :
                          Equations
                          Instances For
                            @[specialize #[]]
                            partial def ByteArray.findIdx?.loop (a : ByteArray) (p : UInt8Bool) (i : Nat) :
                            @[inline]
                            unsafe def ByteArray.forInUnsafe {β : Type v} {m : Type v → Type w} [Monad m] (as : ByteArray) (b : β) (f : UInt8βm (ForInStep β)) :
                            m β

                            We claim this unsafe implementation is correct because an array cannot have more than usizeSz elements in our runtime. This is similar to the Array version.

                            TODO: avoid code duplication in the future after we improve the compiler.

                            Equations
                            Instances For
                              @[specialize #[]]
                              unsafe def ByteArray.forInUnsafe.loop {β : Type v} {m : Type v → Type w} [Monad m] (as : ByteArray) (f : UInt8βm (ForInStep β)) (sz : USize) (i : USize) (b : β) :
                              m β
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                @[implemented_by ByteArray.forInUnsafe]
                                def ByteArray.forIn {β : Type v} {m : Type v → Type w} [Monad m] (as : ByteArray) (b : β) (f : UInt8βm (ForInStep β)) :
                                m β

                                Reference implementation for forIn

                                Equations
                                Instances For
                                  def ByteArray.forIn.loop {β : Type v} {m : Type v → Type w} [Monad m] (as : ByteArray) (f : UInt8βm (ForInStep β)) (i : Nat) (h : i ByteArray.size as) (b : β) :
                                  m β
                                  Equations
                                  Instances For
                                    Equations
                                    • ByteArray.instForInByteArrayUInt8 = { forIn := fun {β : Type u_1} [Monad m] => ByteArray.forIn }
                                    @[inline]
                                    unsafe def ByteArray.foldlMUnsafe {β : Type v} {m : Type v → Type w} [Monad m] (f : βUInt8m β) (init : β) (as : ByteArray) (start : optParam Nat 0) (stop : optParam Nat (ByteArray.size as)) :
                                    m β

                                    See comment at forInUnsafe

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      @[specialize #[]]
                                      unsafe def ByteArray.foldlMUnsafe.fold {β : Type v} {m : Type v → Type w} [Monad m] (f : βUInt8m β) (as : ByteArray) (i : USize) (stop : USize) (b : β) :
                                      m β
                                      Equations
                                      Instances For
                                        @[implemented_by ByteArray.foldlMUnsafe]
                                        def ByteArray.foldlM {β : Type v} {m : Type v → Type w} [Monad m] (f : βUInt8m β) (init : β) (as : ByteArray) (start : optParam Nat 0) (stop : optParam Nat (ByteArray.size as)) :
                                        m β

                                        Reference implementation for foldlM

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          def ByteArray.foldlM.loop {β : Type v} {m : Type v → Type w} [Monad m] (f : βUInt8m β) (as : ByteArray) (stop : Nat) (h : stop ByteArray.size as) (i : Nat) (j : Nat) (b : β) :
                                          m β
                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            @[inline]
                                            def ByteArray.foldl {β : Type v} (f : βUInt8β) (init : β) (as : ByteArray) (start : optParam Nat 0) (stop : optParam Nat (ByteArray.size as)) :
                                            β
                                            Equations
                                            Instances For

                                              Interpret a ByteArray of size 8 as a little-endian UInt64.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For

                                                Interpret a ByteArray of size 8 as a big-endian UInt64.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For