Test whether a byte slice is empty.
Equations
- s.isEmpty = (s.start == s.stop)
Instances For
Returns the subslice obtained by removing the last element.
Equations
- s.pop = s.slice 0 (s.size - 1)
Instances For
Returns the subslice obtained by removing the first element.
Equations
- s.popFront = s.slice 1
Instances For
Folds a monadic function over a ByteSubarray from left to right.
Equations
- s.foldlM f init = ByteArray.foldlM f init s.toByteArray s.start s.stop
Instances For
Implementation of forIn for a ByteSlice.
Equations
- s.forIn init f = ByteSlice.forIn.loop s f s.size ⋯ init
Instances For
Inner loop of the forIn implementation for ByteSlice.
Equations
- One or more equations did not get rendered due to their size.
- ByteSlice.forIn.loop s f 0 x b = pure b
Instances For
Equations
- ByteSlice.instForInUInt8OfMonad_batteries = { forIn := fun {β : Type ?u.14} => ByteSlice.forIn }
Equations
- ByteSlice.instStreamUInt8_batteries = { next? := fun (s : ByteSlice) => do let x ← s[0]? some (x, s.popFront) }
Equations
- ByteSlice.instCoeByteArray_batteries = { coe := fun (as : ByteArray) => as.toByteSlice }
A subarray of a ByteArray.
- array : ByteArray
O(1). Get data array of aByteSubarray. - start : Nat
O(1). Get start index of aByteSubarray. - stop : Nat
O(1). Get stop index of aByteSubarray. Start index is before stop index.
Stop index is before end of data array.
Instances For
O(1). Get the size of a ByteSubarray.
Instances For
O(1). Test if a ByteSubarray is empty.
Instances For
O(n). Extract a ByteSubarray to a ByteArray.
Equations
- self.toByteArray = self.array.extract self.start self.stop
Instances For
O(1). Get the element at index i from the start of a ByteSubarray.
Instances For
Equations
- Batteries.ByteSubarray.instGetElemNatUInt8LtSize = { getElem := fun (self : Batteries.ByteSubarray) (i : Nat) (h : i < self.size) => self.get ⟨i, h⟩ }
O(1). Pop the last element of a ByteSubarray.
Equations
Instances For
O(1). Pop the first element of a ByteSubarray.
Equations
Instances For
Folds a monadic function over a ByteSubarray from left to right.
Instances For
Folds a function over a ByteSubarray from left to right.
Instances For
Implementation of forIn for a ByteSubarray.
Equations
- self.forIn init f = Batteries.ByteSubarray.forIn.loop self f self.size ⋯ init
Instances For
Inner loop of the forIn implementation for ByteSubarray.
Equations
- One or more equations did not get rendered due to their size.
- Batteries.ByteSubarray.forIn.loop self f 0 x b = pure b
Instances For
Equations
- Batteries.ByteSubarray.instForInUInt8OfMonad = { forIn := fun {β : Type ?u.14} => Batteries.ByteSubarray.forIn }
Equations
- Batteries.ByteSubarray.instStreamUInt8 = { next? := fun (s : Batteries.ByteSubarray) => do let x ← s[0]? some (x, s.popFront) }
O(1). Coerce a byte array into a byte slice.
Equations
- array.toByteSubarray = { array := array, start := 0, stop := array.size, start_le_stop := ⋯, stop_le_array_size := ⋯ }
Instances For
Equations
- instCoeByteArrayByteSubarray = { coe := ByteArray.toByteSubarray }