glycerine/go-capnproto

No method to set a Void field of a union

zombiezen opened this issue · 0 comments

The following schema:

struct Foo {
  union {
    bar @0 :Void;
    baz @1 :Void;
  }
}

produces:

type Foo C.Struct
type Foo_Which uint16

const (
    FOO_BAR Foo_Which = 0
    FOO_BAZ Foo_Which = 1
)

func NewFoo(s *C.Segment) Foo      { return Foo(s.NewStruct(8, 0)) }
func NewRootFoo(s *C.Segment) Foo  { return Foo(s.NewRootStruct(8, 0)) }
func ReadRootFoo(s *C.Segment) Foo { return Foo(s.Root(0).ToStruct()) }
func (s Foo) Which() Foo_Which     { return Foo_Which(C.Struct(s).Get16(0)) }

There isn't a method to set the union discriminator for these fields.