| // Code generated by fidlgen; DO NOT EDIT. |
| |
| package constants |
| |
| import ( |
| _strings "strings" |
| _bindings "syscall/zx/fidl" |
| ) |
| |
| const ( |
| Bool bool = true |
| Float32 float32 = 3.14159 |
| Float64 float64 = 3.14159 |
| Int16 int16 = 4 |
| Int32 int32 = 4 |
| Int64 int64 = 4 |
| Int8 int8 = 4 |
| String string = "string" |
| Uint16 uint16 = 4 |
| Uint32 uint32 = 4 |
| Uint64 uint64 = 4 |
| Uint8 uint8 = 4 |
| BitsPrimitiveVal uint32 = BitsTypeValue |
| BitsVal BitsType = BitsTypeValue |
| EnumPrimitiveVal int32 = EnumTypeValue |
| EnumVal EnumType = EnumTypeValue |
| OrResult BitsType = 7 |
| OrResultPrimitiveVal uint32 = 5 |
| ) |
| |
| var _ _bindings.Enum = Enum(0) |
| |
| type Enum uint32 |
| |
| const ( |
| EnumE Enum = 170 |
| ) |
| |
| func (_ Enum) I_EnumValues() []Enum { |
| return []Enum{ |
| EnumE, |
| } |
| } |
| |
| func (_ Enum) I_EnumIsStrict() bool { |
| return true |
| } |
| |
| func (x Enum) IsUnknown() bool { |
| switch x { |
| case 170: |
| return false |
| } |
| return true |
| } |
| |
| func (x Enum) String() string { |
| switch x { |
| case 170: |
| return "E" |
| } |
| return "Unknown" |
| } |
| |
| var _ _bindings.Enum = EnumType(0) |
| |
| type EnumType int32 |
| |
| const ( |
| EnumTypeValue EnumType = 3 |
| EnumTypeSecondValue EnumType = Uint32 |
| ) |
| |
| func (_ EnumType) I_EnumValues() []EnumType { |
| return []EnumType{ |
| EnumTypeValue, |
| EnumTypeSecondValue, |
| } |
| } |
| |
| func (_ EnumType) I_EnumIsStrict() bool { |
| return true |
| } |
| |
| func (x EnumType) IsUnknown() bool { |
| switch x { |
| case 3: |
| return false |
| case Uint32: |
| return false |
| } |
| return true |
| } |
| |
| func (x EnumType) String() string { |
| switch x { |
| case 3: |
| return "Value" |
| case Uint32: |
| return "SecondValue" |
| } |
| return "Unknown" |
| } |
| |
| var _ _bindings.Bits = Bits(0) |
| |
| type Bits uint32 |
| |
| const ( |
| BitsB Bits = 8 |
| Bits_Mask Bits = 8 |
| ) |
| |
| func (_ Bits) I_BitsMask() Bits { |
| return Bits_Mask |
| } |
| |
| func (_ Bits) I_BitsIsStrict() bool { |
| return true |
| } |
| |
| func (x Bits) HasUnknownBits() bool { |
| return x.GetUnknownBits() != 0 |
| } |
| |
| func (x Bits) GetUnknownBits() uint64 { |
| return uint64(^Bits_Mask & x) |
| } |
| |
| func (x Bits) InvertBits() Bits { |
| return Bits_Mask & ^x |
| } |
| |
| // HasBits validates that all flipped bits in the mask are set. |
| func (x Bits) HasBits(mask Bits) bool { |
| return mask|x == x |
| } |
| |
| // ClearBits ensures all flipped bits in the mask are unset. |
| func (x Bits) ClearBits(mask Bits) Bits { |
| return ^mask & x |
| } |
| |
| func (x Bits) String() string { |
| var buf _strings.Builder |
| if 8&x != 0 { |
| if buf.Len() != 0 { |
| buf.WriteRune('|') |
| } |
| buf.WriteString("B") |
| } |
| if buf.Len() == 0 { |
| buf.WriteString("<empty bits>") |
| } |
| return buf.String() |
| } |
| |
| var _ _bindings.Bits = BitsType(0) |
| |
| type BitsType uint32 |
| |
| const ( |
| BitsTypeValue BitsType = 1 |
| BitsTypeSecondValue BitsType = Uint32 |
| BitsTypeThirdValue BitsType = 2 |
| BitsType_Mask BitsType = 7 |
| ) |
| |
| func (_ BitsType) I_BitsMask() BitsType { |
| return BitsType_Mask |
| } |
| |
| func (_ BitsType) I_BitsIsStrict() bool { |
| return true |
| } |
| |
| func (x BitsType) HasUnknownBits() bool { |
| return x.GetUnknownBits() != 0 |
| } |
| |
| func (x BitsType) GetUnknownBits() uint64 { |
| return uint64(^BitsType_Mask & x) |
| } |
| |
| func (x BitsType) InvertBits() BitsType { |
| return BitsType_Mask & ^x |
| } |
| |
| // HasBits validates that all flipped bits in the mask are set. |
| func (x BitsType) HasBits(mask BitsType) bool { |
| return mask|x == x |
| } |
| |
| // ClearBits ensures all flipped bits in the mask are unset. |
| func (x BitsType) ClearBits(mask BitsType) BitsType { |
| return ^mask & x |
| } |
| |
| func (x BitsType) String() string { |
| var buf _strings.Builder |
| if 1&x != 0 { |
| if buf.Len() != 0 { |
| buf.WriteRune('|') |
| } |
| buf.WriteString("Value") |
| } |
| if Uint32&x != 0 { |
| if buf.Len() != 0 { |
| buf.WriteRune('|') |
| } |
| buf.WriteString("SecondValue") |
| } |
| if 2&x != 0 { |
| if buf.Len() != 0 { |
| buf.WriteRune('|') |
| } |
| buf.WriteString("ThirdValue") |
| } |
| if buf.Len() == 0 { |
| buf.WriteString("<empty bits>") |
| } |
| return buf.String() |
| } |
| |
| type Struct struct { |
| _ struct{} `fidl:"s" fidl_size_v2:"40" fidl_alignment_v2:"8"` |
| Int64WithDefault int64 `fidl_offset_v2:"0"` |
| StringWithDefault string `fidl_offset_v2:"8" fidl_bounds:""` |
| BoolWithDefault bool `fidl_offset_v2:"24"` |
| EnumWithDefault Enum `fidl_offset_v2:"28"` |
| BitsWithDefault Bits `fidl_offset_v2:"32"` |
| } |
| |
| var _mStruct = _bindings.CreateLazyMarshaler(Struct{}) |
| |
| func (msg *Struct) Marshaler() _bindings.Marshaler { |
| return _mStruct |
| } |