@[extern lean_mk_empty_byte_array]
Equations
- ByteArray.mkEmpty c = { data := #[] }
Equations
- ByteArray.instInhabitedByteArray = { default := ByteArray.empty }
Equations
- ByteArray.instEmptyCollectionByteArray = { emptyCollection := ByteArray.empty }
@[extern lean_byte_array_push]
Equations
- ByteArray.push _fun_discr _fun_discr = match _fun_discr, _fun_discr with | { data := bs }, b => { data := Array.push bs b }
@[extern lean_byte_array_size]
Equations
- ByteArray.size _fun_discr = match _fun_discr with | { data := bs } => Array.size bs
@[extern lean_byte_array_uget]
Equations
- ByteArray.uget _fun_discr _fun_discr _fun_discr = match _fun_discr, _fun_discr, _fun_discr with | { data := bs }, i, h => Array.uget bs i h
@[extern lean_byte_array_get]
Equations
- ByteArray.get! _fun_discr _fun_discr = match _fun_discr, _fun_discr with | { data := bs }, i => Array.get! bs i
@[extern lean_byte_array_fget]
Equations
- ByteArray.get _fun_discr _fun_discr = match _fun_discr, _fun_discr with | { data := bs }, i => Array.get bs i
@[inline]
Equations
- ByteArray.getOp self idx = ByteArray.get! self idx
@[extern lean_byte_array_set]
Equations
- ByteArray.set! _fun_discr _fun_discr _fun_discr = match _fun_discr, _fun_discr, _fun_discr with | { data := bs }, i, b => { data := Array.set! bs i b }
@[extern lean_byte_array_fset]
Equations
- ByteArray.set _fun_discr _fun_discr _fun_discr = match _fun_discr, _fun_discr, _fun_discr with | { data := bs }, i, b => { data := Array.set bs i b }
@[extern lean_byte_array_uset]
def
ByteArray.uset
(a : ByteArray)
(i : USize)
:
(a : UInt8) → USize.toNat i < ByteArray.size a → ByteArray
Equations
- ByteArray.uset _fun_discr _fun_discr _fun_discr _fun_discr = match _fun_discr, _fun_discr, _fun_discr, _fun_discr with | { data := bs }, i, v, h => { data := Array.uset bs i v h }
Equations
- ByteArray.isEmpty s = (ByteArray.size s == 0)
@[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.
Equations
- ByteArray.extract a b e = ByteArray.copySlice a b ByteArray.empty 0 (e - b)
Equations
- ByteArray.append a b = ByteArray.copySlice b 0 a (ByteArray.size a) (ByteArray.size b) false
Equations
- ByteArray.instAppendByteArray = { append := ByteArray.append }
Equations
- ByteArray.toList bs = ByteArray.toList.loop bs 0 []
@[inline]
Equations
- ByteArray.findIdx? a p start = ByteArray.findIdx?.loop a p start
@[inline]
unsafe def
ByteArray.forInUnsafe
{β : Type v}
{m : Type v → Type w}
[inst : Monad m]
(as : ByteArray)
(b : β)
(f : UInt8 → β → m (ForInStep β))
:
m β
Equations
- ByteArray.forInUnsafe as b f = let sz := USize.ofNat (ByteArray.size as); ByteArray.forInUnsafe.loop as f sz 0 b
@[implementedBy ByteArray.forInUnsafe]
def
ByteArray.forIn
{β : Type v}
{m : Type v → Type w}
[inst : Monad m]
(as : ByteArray)
(b : β)
(f : UInt8 → β → m (ForInStep β))
:
m β
Equations
- ByteArray.forIn as b f = ByteArray.forIn.loop as f (ByteArray.size as) (_ : ByteArray.size as ≤ ByteArray.size as) b
def
ByteArray.forIn.loop
{β : Type v}
{m : Type v → Type w}
[inst : Monad m]
(as : ByteArray)
(f : UInt8 → β → m (ForInStep β))
(i : Nat)
(h : i ≤ ByteArray.size as)
(b : β)
:
m β
Equations
- One or more equations did not get rendered due to their size.
- ByteArray.forIn.loop as f 0 x b = pure b
@[inline]
unsafe def
ByteArray.foldlMUnsafe
{β : Type v}
{m : Type v → Type w}
[inst : Monad m]
(f : β → UInt8 → m β)
(init : β)
(as : ByteArray)
(start : optParam Nat 0)
(stop : optParam Nat (ByteArray.size as))
:
m β
Equations
- One or more equations did not get rendered due to their size.
@[implementedBy ByteArray.foldlMUnsafe]
def
ByteArray.foldlM
{β : Type v}
{m : Type v → Type w}
[inst : Monad m]
(f : β → UInt8 → m β)
(init : β)
(as : ByteArray)
(start : optParam Nat 0)
(stop : optParam Nat (ByteArray.size as))
:
m β
Equations
- One or more equations did not get rendered due to their size.
def
ByteArray.foldlM.loop
{β : Type v}
{m : Type v → Type w}
[inst : Monad m]
(f : β → UInt8 → m β)
(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.
@[inline]
def
ByteArray.foldl
{β : Type v}
(f : β → UInt8 → β)
(init : β)
(as : ByteArray)
(start : optParam Nat 0)
(stop : optParam Nat (ByteArray.size as))
:
β
Equations
- ByteArray.foldl f init as start stop = Id.run (ByteArray.foldlM f init as start stop)
Equations
Equations
- List.toByteArray.loop [] _fun_discr = _fun_discr
- List.toByteArray.loop (b :: bs) _fun_discr = List.toByteArray.loop bs (ByteArray.push _fun_discr b)
Equations
- instToStringByteArray = { toString := fun bs => List.toString (ByteArray.toList bs) }