blob: da57b0902fb1b6df321434a8b499917347dd59a8 [file] [log] [blame]
// Code generated by fidlgen; DO NOT EDIT.
package name
import (
_bindings "syscall/zx/fidl"
)
const (
// const comment #1
//
// const comment #3
C int32 = 4
)
// enum comment #1.
//
// enum comment #2.
type MyEnum uint32
const (
MyEnumFoo MyEnum = 1
MyEnumBar MyEnum = 2
)
func (_ MyEnum) I_EnumValues() []MyEnum {
return []MyEnum{
MyEnumFoo,
MyEnumBar,
}
}
func (x MyEnum) String() string {
switch x {
case 1:
return "Foo"
case 2:
return "Bar"
}
return "Unknown"
}
// bits comment #1
//
// bits comment #2
type MyBits uint32
const (
MyBitsMyFirstBit MyBits = 1
MyBitsMyOtherBit MyBits = 2
)
func (x MyBits) String() string {
switch x {
case 1:
return "MyFirstBit"
case 2:
return "MyOtherBit"
}
return "Unknown"
}
// struct comment #1
//
// struct comment #3
type Struct struct {
_ struct{} `fidl:"s" fidl_size_v1:"4" fidl_alignment_v1:"4"`
// struct member comment #1
//
// struct member comment #3
Field int32 `fidl_offset_v1:"0"`
}
var _mStruct = _bindings.CreateLazyMarshaler(Struct{})
func (msg *Struct) Marshaler() _bindings.Marshaler {
return _mStruct
}
type I_unionTag uint64
const (
UnionField = 1 // 0x00000001
)
// union comment #1
//
// union comment #3
type Union struct {
I_unionTag `fidl:"x!" fidl_size_v1:"24" fidl_alignment_v1:"8"`
// union member comment #1
//
// union member comment #3
Field int32 `fidl_ordinal:"1"`
}
func (_m *Union) Which() I_unionTag {
return _m.I_unionTag
}
func (_m *Union) Ordinal() uint64 {
return uint64(_m.I_unionTag)
}
func (_m *Union) SetField(field int32) {
_m.I_unionTag = UnionField
_m.Field = field
}
func UnionWithField(field int32) Union {
var _u Union
_u.SetField(field)
return _u
}
// table comment #1
//
// table comment #3
type Table struct {
_ struct{} `fidl:"t" fidl_size_v1:"16" fidl_alignment_v1:"8"`
// table field comment #1
//
// table field comment #3
Field int32 `fidl_ordinal:"1"`
FieldPresent bool
}
func (u *Table) SetField(field int32) {
u.Field = field
u.FieldPresent = true
}
func (u *Table) GetField() int32 {
return u.Field
}
func (u *Table) GetFieldWithDefault(_default int32) int32 {
if !u.HasField() {
return _default
}
return u.Field
}
func (u *Table) HasField() bool {
return u.FieldPresent
}
func (u *Table) ClearField() {
u.FieldPresent = false
}
const (
InterfaceMethodOrdinal uint64 = 0x60e700e002995ef8
InterfaceOnEventOrdinal uint64 = 0x914c226136244ed
)
type InterfaceWithCtxInterface _bindings.ChannelProxy
// method comment #1
//
// method comment #3
func (p *InterfaceWithCtxInterface) Method(ctx_ _bindings.Context) error {
var req_ _bindings.Message
err_ := ((*_bindings.ChannelProxy)(p)).Send(InterfaceMethodOrdinal, req_)
return err_
}
// event comment #1
//
// event comment #3
func (p *InterfaceWithCtxInterface) ExpectOnEvent(ctx_ _bindings.Context) error {
var resp_ _bindings.Message
err_ := ((*_bindings.ChannelProxy)(p)).Recv(InterfaceOnEventOrdinal, resp_)
return err_
}
// interface comment #1
//
// interface comment #3
type InterfaceWithCtx interface {
// method comment #1
//
// method comment #3
Method(ctx_ _bindings.Context) error
// event comment #1
//
// event comment #3
}
type InterfaceWithCtxTransitionalBase struct{}
type InterfaceWithCtxInterfaceRequest _bindings.InterfaceRequest
func NewInterfaceWithCtxInterfaceRequest() (InterfaceWithCtxInterfaceRequest, *InterfaceWithCtxInterface, error) {
req, cli, err := _bindings.NewInterfaceRequest()
return InterfaceWithCtxInterfaceRequest(req), (*InterfaceWithCtxInterface)(cli), err
}
type InterfaceWithCtxStub struct {
Impl InterfaceWithCtx
}
func (s_ *InterfaceWithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) {
switch args_.Ordinal {
case InterfaceMethodOrdinal:
err_ := s_.Impl.Method(args_.Ctx)
return nil, false, err_
}
return nil, false, _bindings.ErrUnknownOrdinal
}
type InterfaceEventProxy _bindings.ChannelProxy
func (p *InterfaceEventProxy) OnEvent() error {
var event_ _bindings.Message
return ((*_bindings.ChannelProxy)(p)).Send(InterfaceOnEventOrdinal, event_)
}