| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| package placementofattributes |
| |
| import ( |
| testexampleusing "fidl/test/exampleusing" |
| _strings "strings" |
| _bindings "syscall/zx/fidl" |
| ) |
| |
| const ( |
| ExampleConst uint32 = 0 |
| ) |
| |
| type Alias = uint32 |
| |
| var _ _bindings.Enum = ExampleEnum(0) |
| |
| type ExampleEnum uint32 |
| |
| const ( |
| ExampleEnumMember ExampleEnum = 1 |
| ) |
| |
| func (_ ExampleEnum) I_EnumValues() []ExampleEnum { |
| return []ExampleEnum{ |
| ExampleEnumMember, |
| } |
| } |
| |
| func (_ ExampleEnum) I_EnumIsStrict() bool { |
| return true |
| } |
| |
| func (x ExampleEnum) IsUnknown() bool { |
| switch x { |
| case 1: |
| return false |
| } |
| return true |
| } |
| |
| func (x ExampleEnum) String() string { |
| switch x { |
| case 1: |
| return "Member" |
| } |
| return "Unknown" |
| } |
| |
| var _ _bindings.Bits = ExampleBits(0) |
| |
| type ExampleBits uint32 |
| |
| const ( |
| ExampleBitsMember ExampleBits = 1 |
| ExampleBits_Mask ExampleBits = 1 |
| ) |
| |
| func (_ ExampleBits) I_BitsMask() ExampleBits { |
| return ExampleBits_Mask |
| } |
| |
| func (_ ExampleBits) I_BitsIsStrict() bool { |
| return true |
| } |
| |
| func (x ExampleBits) HasUnknownBits() bool { |
| return x.GetUnknownBits() != 0 |
| } |
| |
| func (x ExampleBits) GetUnknownBits() uint64 { |
| return uint64(^ExampleBits_Mask & x) |
| } |
| |
| func (x ExampleBits) InvertBits() ExampleBits { |
| return ExampleBits_Mask & ^x |
| } |
| |
| // HasBits validates that all flipped bits in the mask are set. |
| func (x ExampleBits) HasBits(mask ExampleBits) bool { |
| return mask|x == x |
| } |
| |
| // ClearBits ensures all flipped bits in the mask are unset. |
| func (x ExampleBits) ClearBits(mask ExampleBits) ExampleBits { |
| return ^mask & x |
| } |
| |
| func (x ExampleBits) String() string { |
| var buf _strings.Builder |
| if 1&x != 0 { |
| if buf.Len() != 0 { |
| buf.WriteRune('|') |
| } |
| buf.WriteString("Member") |
| } |
| if buf.Len() == 0 { |
| buf.WriteString("<empty bits>") |
| } |
| return buf.String() |
| } |
| |
| type ExampleProtocolMethodRequest struct { |
| _ struct{} `fidl:"s" fidl_size_v2:"1" fidl_alignment_v2:"1"` |
| Arg testexampleusing.Empty `fidl_offset_v2:"0"` |
| } |
| |
| var _mExampleProtocolMethodRequest = _bindings.CreateLazyMarshaler(ExampleProtocolMethodRequest{}) |
| |
| func (msg *ExampleProtocolMethodRequest) Marshaler() _bindings.Marshaler { |
| return _mExampleProtocolMethodRequest |
| } |
| |
| type ExampleStruct struct { |
| _ struct{} `fidl:"s" fidl_size_v2:"4" fidl_alignment_v2:"4"` |
| Member uint32 `fidl_offset_v2:"0"` |
| } |
| |
| var _mExampleStruct = _bindings.CreateLazyMarshaler(ExampleStruct{}) |
| |
| func (msg *ExampleStruct) Marshaler() _bindings.Marshaler { |
| return _mExampleStruct |
| } |
| |
| type I_exampleUnionTag uint64 |
| |
| const ( |
| ExampleUnionVariant = 1 // 0x00000001 |
| ) |
| |
| type ExampleUnion struct { |
| I_exampleUnionTag `fidl:"x!" fidl_size_v2:"16" fidl_alignment_v2:"8" fidl_resource:"false"` |
| Variant uint32 `fidl_ordinal:"1"` |
| } |
| |
| var _mExampleUnion = _bindings.CreateLazyMarshaler(ExampleUnion{}) |
| |
| func (msg *ExampleUnion) Marshaler() _bindings.Marshaler { |
| return _mExampleUnion |
| } |
| |
| func (_m *ExampleUnion) reset() { |
| switch _m.I_exampleUnionTag { |
| case 1: |
| var _zeroed uint32 |
| _m.Variant = _zeroed |
| } |
| } |
| |
| func (_m *ExampleUnion) Which() I_exampleUnionTag { |
| return _m.I_exampleUnionTag |
| } |
| |
| func (_m *ExampleUnion) Ordinal() uint64 { |
| return uint64(_m.I_exampleUnionTag) |
| } |
| |
| func (_m *ExampleUnion) SetVariant(variant uint32) { |
| _m.reset() |
| _m.I_exampleUnionTag = ExampleUnionVariant |
| _m.Variant = variant |
| } |
| |
| func ExampleUnionWithVariant(variant uint32) ExampleUnion { |
| var _u ExampleUnion |
| _u.SetVariant(variant) |
| return _u |
| } |
| |
| type ExampleTable struct { |
| _ struct{} `fidl:"t" fidl_size_v2:"16" fidl_alignment_v2:"8" fidl_resource:"false"` |
| I_unknownData interface{} |
| Member uint32 `fidl_ordinal:"1"` |
| MemberPresent bool |
| } |
| |
| var _mExampleTable = _bindings.CreateLazyMarshaler(ExampleTable{}) |
| |
| func (msg *ExampleTable) Marshaler() _bindings.Marshaler { |
| return _mExampleTable |
| } |
| |
| func (u *ExampleTable) SetMember(member uint32) { |
| u.Member = member |
| u.MemberPresent = true |
| } |
| |
| func (u *ExampleTable) GetMember() uint32 { |
| return u.Member |
| } |
| |
| func (u *ExampleTable) GetMemberWithDefault(_default uint32) uint32 { |
| if !u.HasMember() { |
| return _default |
| } |
| return u.Member |
| } |
| |
| func (u *ExampleTable) HasMember() bool { |
| return u.MemberPresent |
| } |
| |
| func (u *ExampleTable) ClearMember() { |
| u.MemberPresent = false |
| } |
| |
| func (u *ExampleTable) HasUnknownData() bool { |
| return u.I_unknownData != nil |
| } |
| |
| func (u *ExampleTable) GetUnknownData() map[uint64]_bindings.UnknownData { |
| return u.I_unknownData.(map[uint64]_bindings.UnknownData) |
| } |
| |
| const ( |
| ExampleProtocolMethodOrdinal uint64 = 0x53978e6fc7476749 |
| ) |
| |
| type ExampleProtocolWithCtxInterface _bindings.ChannelProxy |
| |
| func (p *ExampleProtocolWithCtxInterface) Method(ctx_ _bindings.Context, arg testexampleusing.Empty) error { |
| req_ := &ExampleProtocolMethodRequest{Arg: arg} |
| err_ := ((*_bindings.ChannelProxy)(p)).Send(ExampleProtocolMethodOrdinal, req_) |
| return err_ |
| } |
| |
| type ExampleProtocolWithCtx interface { |
| Method(ctx_ _bindings.Context, arg testexampleusing.Empty) error |
| } |
| type ExampleProtocolWithCtxInterfaceRequest _bindings.InterfaceRequest |
| |
| func NewExampleProtocolWithCtxInterfaceRequest() (ExampleProtocolWithCtxInterfaceRequest, *ExampleProtocolWithCtxInterface, error) { |
| req, cli, err := _bindings.NewInterfaceRequest() |
| return ExampleProtocolWithCtxInterfaceRequest(req), (*ExampleProtocolWithCtxInterface)(cli), err |
| } |
| |
| type ExampleProtocolWithCtxStub struct { |
| Impl ExampleProtocolWithCtx |
| } |
| |
| func (s_ *ExampleProtocolWithCtxStub) Dispatch(args_ _bindings.DispatchArgs) (_bindings.Message, bool, error) { |
| switch args_.Ordinal { |
| case ExampleProtocolMethodOrdinal: |
| in_ := &ExampleProtocolMethodRequest{} |
| marshalerCtx, ok := _bindings.GetMarshalerContext(args_.Ctx) |
| if !ok { |
| return nil, false, _bindings.ErrMissingMarshalerContext |
| } |
| if err_ := _bindings.Unmarshal(marshalerCtx, args_.Bytes, args_.HandleInfos, in_); err_ != nil { |
| return nil, false, err_ |
| } |
| err_ := s_.Impl.Method(args_.Ctx, (*in_).Arg) |
| return nil, false, err_ |
| } |
| return nil, false, _bindings.ErrUnknownOrdinal |
| } |
| |
| type ExampleProtocolEventProxy _bindings.ChannelProxy |