def varint.read.result
import bend-kit-protobuf@0.2.0.0/protobuf.bend as Protobufimport Base
import bend-kit-bytes@0.3.3.0/bytes.bend as B
98def varint.read.result(i: U32, last: U32, max_last: U32, r: B.Cursor & Maybe<&2, U32>) -> B.Cursor & Maybe<&2, VarintByte>:
99 (c, m) = r
100 match m:
101 case None{}:
102 (c, None{})
103 case Some{+b}:
104 (c, Some{VarintByte{U32.is_eq(i, last) && U32.is_gt(b, max_last), U32.is_lt(b, 128), b}})