def rep.read

bendonnect-rpc@0.1.0.0 · src/pb.bend:537

import bendonnect-rpc@0.1.0.0/src/pb.bend as Pb
import Base
import bend-kit-protobuf@0.1.0.0/protobuf.bend as Pb

537# wire: 0 varint, 1 fixed64, 5 fixed32 (the element encoding inside a packed blob).
538def rep.read(~T: Data, ~read: Pb.Value -> Result<&2, &1, String, T>, +wire: U32, v: Pb.Value, acc: List<&2, T>) -> Result<&2, &1, String, List<&2, T>>:
539  match v:
540    case Pb.Blob{b}:
541      rep.packed(~T, ~read, Pb.packed_decode(wire, b, max_size()), acc)
542    case Pb.Varint{w}:
543      rep.single(~T, ~read, Pb.Varint{w}, acc)
544    case Pb.Fixed32{x}:
545      rep.single(~T, ~read, Pb.Fixed32{x}, acc)
546    case Pb.Fixed64{w}:
547      rep.single(~T, ~read, Pb.Fixed64{w}, acc)
548    case Pb.Group{fs}:
549      Fail{"protobuf: unexpected group in repeated field"}

Uses (9)

Used by (14)