func _Bar_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { m := msg.(*Bar) switch tag { case 11: // pick.a if wire != proto1.WireVarint { return true, proto1.ErrInternalBadWireType } x, err := b.DecodeVarint() m.Pick = &Bar_A{x != 0} return true, err case 12: // pick.b if wire != proto1.WireVarint { return true, proto1.ErrInternalBadWireType } x, err := b.DecodeVarint() m.Pick = &Bar_B{x != 0} return true, err default: return false, nil } }
func _MsgWithOneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { m := msg.(*MsgWithOneof) switch tag { case 1: // union.title if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType } x, err := b.DecodeStringBytes() m.Union = &MsgWithOneof_Title{x} return true, err case 2: // union.salary if wire != proto.WireVarint { return true, proto.ErrInternalBadWireType } x, err := b.DecodeVarint() m.Union = &MsgWithOneof_Salary{int64(x)} return true, err default: return false, nil } }
func _MsgWithOneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { m := msg.(*MsgWithOneof) // union switch x := m.Union.(type) { case *MsgWithOneof_Title: _ = b.EncodeVarint(1<<3 | proto.WireBytes) _ = b.EncodeStringBytes(x.Title) case *MsgWithOneof_Salary: _ = b.EncodeVarint(2<<3 | proto.WireVarint) _ = b.EncodeVarint(uint64(x.Salary)) case nil: default: return fmt.Errorf("MsgWithOneof.Union has unexpected type %T", x) } return nil }
func _Bar_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { m := msg.(*Bar) // pick switch x := m.Pick.(type) { case *Bar_A: t := uint64(0) if x.A { t = 1 } _ = b.EncodeVarint(11<<3 | proto1.WireVarint) _ = b.EncodeVarint(t) case *Bar_B: t := uint64(0) if x.B { t = 1 } _ = b.EncodeVarint(12<<3 | proto1.WireVarint) _ = b.EncodeVarint(t) case nil: default: return fmt.Errorf("Bar.Pick has unexpected type %T", x) } return nil }
func _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { m := msg.(*Communique) switch tag { case 5: // union.number if wire != proto.WireVarint { return true, proto.ErrInternalBadWireType } x, err := b.DecodeVarint() m.Union = &Communique_Number{int32(x)} return true, err case 6: // union.name if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType } x, err := b.DecodeStringBytes() m.Union = &Communique_Name{x} return true, err case 7: // union.data if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType } x, err := b.DecodeRawBytes(true) m.Union = &Communique_Data{x} return true, err case 8: // union.temp_c if wire != proto.WireFixed64 { return true, proto.ErrInternalBadWireType } x, err := b.DecodeFixed64() m.Union = &Communique_TempC{math.Float64frombits(x)} return true, err case 9: // union.height if wire != proto.WireFixed32 { return true, proto.ErrInternalBadWireType } x, err := b.DecodeFixed32() m.Union = &Communique_Height{math.Float32frombits(uint32(x))} return true, err case 10: // union.today if wire != proto.WireVarint { return true, proto.ErrInternalBadWireType } x, err := b.DecodeVarint() m.Union = &Communique_Today{Days(x)} return true, err case 11: // union.maybe if wire != proto.WireVarint { return true, proto.ErrInternalBadWireType } x, err := b.DecodeVarint() m.Union = &Communique_Maybe{x != 0} return true, err case 12: // union.delta if wire != proto.WireVarint { return true, proto.ErrInternalBadWireType } x, err := b.DecodeZigzag32() m.Union = &Communique_Delta_{int32(x)} return true, err case 13: // union.msg if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType } msg := new(Reply) err := b.DecodeMessage(msg) m.Union = &Communique_Msg{msg} return true, err case 14: // union.somegroup if wire != proto.WireStartGroup { return true, proto.ErrInternalBadWireType } msg := new(Communique_SomeGroup) err := b.DecodeGroup(msg) m.Union = &Communique_Somegroup{msg} return true, err default: return false, nil } }
func _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { m := msg.(*Communique) // union switch x := m.Union.(type) { case *Communique_Number: _ = b.EncodeVarint(5<<3 | proto.WireVarint) _ = b.EncodeVarint(uint64(x.Number)) case *Communique_Name: _ = b.EncodeVarint(6<<3 | proto.WireBytes) _ = b.EncodeStringBytes(x.Name) case *Communique_Data: _ = b.EncodeVarint(7<<3 | proto.WireBytes) _ = b.EncodeRawBytes(x.Data) case *Communique_TempC: _ = b.EncodeVarint(8<<3 | proto.WireFixed64) _ = b.EncodeFixed64(math.Float64bits(x.TempC)) case *Communique_Height: _ = b.EncodeVarint(9<<3 | proto.WireFixed32) _ = b.EncodeFixed32(uint64(math.Float32bits(x.Height))) case *Communique_Today: _ = b.EncodeVarint(10<<3 | proto.WireVarint) _ = b.EncodeVarint(uint64(x.Today)) case *Communique_Maybe: t := uint64(0) if x.Maybe { t = 1 } _ = b.EncodeVarint(11<<3 | proto.WireVarint) _ = b.EncodeVarint(t) case *Communique_Delta_: _ = b.EncodeVarint(12<<3 | proto.WireVarint) _ = b.EncodeZigzag32(uint64(x.Delta)) case *Communique_Msg: _ = b.EncodeVarint(13<<3 | proto.WireBytes) if err := b.EncodeMessage(x.Msg); err != nil { return err } case *Communique_Somegroup: _ = b.EncodeVarint(14<<3 | proto.WireStartGroup) if err := b.Marshal(x.Somegroup); err != nil { return err } _ = b.EncodeVarint(14<<3 | proto.WireEndGroup) case nil: default: return fmt.Errorf("Communique.Union has unexpected type %T", x) } return nil }