github.com/filecoin-project/specs-actors/v4@v4.0.2/actors/util/smoothing/cbor_gen.go (about) 1 // Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT. 2 3 package smoothing 4 5 import ( 6 "fmt" 7 "io" 8 9 cbg "github.com/whyrusleeping/cbor-gen" 10 xerrors "golang.org/x/xerrors" 11 ) 12 13 var _ = xerrors.Errorf 14 15 var lengthBufFilterEstimate = []byte{130} 16 17 func (t *FilterEstimate) MarshalCBOR(w io.Writer) error { 18 if t == nil { 19 _, err := w.Write(cbg.CborNull) 20 return err 21 } 22 if _, err := w.Write(lengthBufFilterEstimate); err != nil { 23 return err 24 } 25 26 // t.PositionEstimate (big.Int) (struct) 27 if err := t.PositionEstimate.MarshalCBOR(w); err != nil { 28 return err 29 } 30 31 // t.VelocityEstimate (big.Int) (struct) 32 if err := t.VelocityEstimate.MarshalCBOR(w); err != nil { 33 return err 34 } 35 return nil 36 } 37 38 func (t *FilterEstimate) UnmarshalCBOR(r io.Reader) error { 39 *t = FilterEstimate{} 40 41 br := cbg.GetPeeker(r) 42 scratch := make([]byte, 8) 43 44 maj, extra, err := cbg.CborReadHeaderBuf(br, scratch) 45 if err != nil { 46 return err 47 } 48 if maj != cbg.MajArray { 49 return fmt.Errorf("cbor input should be of type array") 50 } 51 52 if extra != 2 { 53 return fmt.Errorf("cbor input had wrong number of fields") 54 } 55 56 // t.PositionEstimate (big.Int) (struct) 57 58 { 59 60 if err := t.PositionEstimate.UnmarshalCBOR(br); err != nil { 61 return xerrors.Errorf("unmarshaling t.PositionEstimate: %w", err) 62 } 63 64 } 65 // t.VelocityEstimate (big.Int) (struct) 66 67 { 68 69 if err := t.VelocityEstimate.UnmarshalCBOR(br); err != nil { 70 return xerrors.Errorf("unmarshaling t.VelocityEstimate: %w", err) 71 } 72 73 } 74 return nil 75 }