fields.bend checks
raw source on the hub · import lawful-fields@0.1.0.0/fields.bend as Fields
3 imports
import Base import lawful-bytes@0.1.0.0/defs.bend as D import lawful-bytes@0.1.0.0/bytes.bend as B
Definitions
def cut.cons source · line 9 · raw
@+e:U32 -> @r:Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, List<&2, U32>) -> Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, List<&2, U32>)
def cut.next source · line 15 · raw
@want:Bool -> @b:0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes -> @+from:U32 -> @+to:U32 -> @+sep:U32 -> Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32)
The end of the piece starting at from, searched only when want is set (no scan past the last field asked for; the answer is then unused).
def cut.go source · line 24 · raw
@+n:Nat -> @more:Bool -> @r:Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32) -> @+to:U32 -> @+sep:U32 -> Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, List<&2, U32>)
n counts the pieces still wanted, this one included; more says the previous piece ended at a separator; r holds this piece's end.
def cut source · line 39 · raw
@b:0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes -> @+from:U32 -> @+to:U32 -> @+sep:U32 -> @+n:Nat -> Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, List<&2, U32>)
The end offsets of the first n pieces of bytes from .. to-1, split at sep: each end is where a separator is, or to for the last piece.
def num.fin source · line 42 · raw
@+acc:U32 -> @ok:Bool -> Maybe<&2, U32>
def num.out source · line 49 · raw
@+acc:U32 -> @ok:Bool -> @r:Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32) -> Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, Maybe<&2, U32>)
def num.go source · line 55 · raw
@n:Nat -> @r:Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32) -> @+j:U32 -> @+acc:U32 -> @ok:Bool -> Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, Maybe<&2, U32>)
r holds byte j; acc is the value so far; ok says every byte was a digit and nothing overflowed.
def num source · line 67 · raw
@b:0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes -> @+from:U32 -> @+to:U32 -> Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, Maybe<&2, U32>)
The decimal number in bytes from .. to-1, if it is one and below 2^32.
def digits.out source · line 70 · raw
@ok:Bool -> @r:Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32) -> Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, Bool)
def digits.go source · line 75 · raw
@n:Nat -> @r:Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32) -> @+j:U32 -> @ok:Bool -> Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, Bool)
r holds byte j; ok says every byte so far was a digit.
def digits source · line 84 · raw
@b:0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes -> @+from:U32 -> @+to:U32 -> Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, Bool)
Bytes from .. to-1 are one or more decimal digits (a number of any size).
def put_dec.go source · line 87 · raw
@xs:List<&2, U32> -> @b:0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes -> 0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes
def put_dec.digits source · line 96 · raw
@k:Nat -> @small:Bool -> @+n:U32 -> @acc:List<&2, U32> -> List<&2, U32>
The decimal digits of n, most significant first, before acc; small says n < 10 (the last digit). At most 10 steps for a U32.
def put_dec.list source · line 105 · raw
@+n:U32 -> List<&2, U32>
def put_dec source · line 109 · raw
@b:0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes -> @+n:U32 -> 0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes
n written in decimal at the end of b (for room enough: at most 10 bytes).