fidlgen

package
v0.0.0-...-8023e94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2021 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ObjectTypeNone = ObjectType(iota)
	ObjectTypeProcess
	ObjectTypeThread
	ObjectTypeVmo
	ObjectTypeChannel
	ObjectTypeEvent
	ObjectTypePort

	ObjectTypeInterrupt

	ObjectTypePciDevice
	ObjectTypeLog

	ObjectTypeSocket
	ObjectTypeResource
	ObjectTypeEventPair
	ObjectTypeJob
	ObjectTypeVmar
	ObjectTypeFifo
	ObjectTypeGuest
	ObjectTypeVcpu
	ObjectTypeTimer
	ObjectTypeIommu
	ObjectTypeBti
	ObjectTypeProfile
	ObjectTypePmt
	ObjectTypeSuspendToken
	ObjectTypePager
	ObjectTypeException
	ObjectTypeClock
)

Variables

This section is empty.

Functions

func ConstNameToAllCapsSnake

func ConstNameToAllCapsSnake(name string) string

Convert a const name from kCamelCase to ALL_CAPS_SNAKE style

func PrintableASCII

func PrintableASCII(s string) bool

PrintableASCII reports whether s is made of only printable ASCII runes.

func PrintableASCIIRune

func PrintableASCIIRune(r rune) bool

PrintableASCIIRune reports whether r is a printable ASCII rune, i.e. in the range 0x20 to 0x7E.

func RemoveLeadingK

func RemoveLeadingK(name string) string

Removes a leading 'k' if the second character is upper-case, otherwise returns the argument

func SingleQuote

func SingleQuote(s string) string

func ToFriendlyCase

func ToFriendlyCase(name string) string

Convert text to friendly case style (like snake case, but with spaces)

func ToLowerCamelCase

func ToLowerCamelCase(name string) string

Convert a name to lowerCamelCase style

func ToSnakeCase

func ToSnakeCase(name string) string

Convert text to snake_case style

func ToUpperCamelCase

func ToUpperCamelCase(name string) string

Convert a name to UpperCamelCase style

Types

type Attribute

type Attribute struct {
	Name  Identifier `json:"name"`
	Value string     `json:"value"`
}

type Attributes

type Attributes struct {
	Attributes []Attribute `json:"maybe_attributes,omitempty"`
}

Attributes represents a list of attributes. It conveniently implements the `Annotated` protocol, such that it can be embedded into other node structs which are annotated.

func (Attributes) BindingsDenylistIncludes

func (el Attributes) BindingsDenylistIncludes(targetLanguage string) bool

BindingsDenylistIncludes returns true if the comma-separated BindingsDenyList attribute includes targetLanguage (meaning the bindings for targetLanguage should not emit this declaration).

func (Attributes) DocComments

func (el Attributes) DocComments() []string

func (Attributes) GetAttribute

func (el Attributes) GetAttribute(name Identifier) Attribute

func (Attributes) HasAttribute

func (el Attributes) HasAttribute(name Identifier) bool

func (Attributes) LookupAttribute

func (el Attributes) LookupAttribute(name Identifier) (Attribute, bool)

func (Attributes) Transports

func (el Attributes) Transports() map[string]struct{}

type Bits

type Bits struct {
	Attributes
	Type       Type                      `json:"type"`
	Name       EncodedCompoundIdentifier `json:"name"`
	Mask       string                    `json:"mask"`
	Members    []BitsMember              `json:"members"`
	Strictness `json:"strict"`
}

Bits represents a FIDL declaration of an bits.

type BitsMember

type BitsMember struct {
	Attributes
	Name  Identifier `json:"name"`
	Value Constant   `json:"value"`
}

BitsMember represents a single variant in a FIDL bits.

type CompoundIdentifier

type CompoundIdentifier struct {
	Library LibraryIdentifier
	Name    Identifier
	Member  Identifier
}

func (CompoundIdentifier) Encode

type Const

type Const struct {
	Attributes
	Type  Type                      `json:"type"`
	Name  EncodedCompoundIdentifier `json:"name"`
	Value Constant                  `json:"value"`
}

Const represents a FIDL declaration of a named constant.

type Constant

type Constant struct {
	Kind       ConstantKind              `json:"kind"`
	Identifier EncodedCompoundIdentifier `json:"identifier,omitempty"`
	Literal    Literal                   `json:"literal,omitempty"`
	Value      string                    `json:"value"`
}

type ConstantKind

type ConstantKind string
const (
	IdentifierConstant ConstantKind = "identifier"
	LiteralConstant    ConstantKind = "literal"
	BinaryOperator     ConstantKind = "binary_operator"
)

type DeclInfo

type DeclInfo struct {
	Type DeclType `json:"kind"`
	// Present for structs, tables, and unions.
	*Resourceness `json:"resource,omitempty"`
}

type DeclInfoMap

type DeclInfoMap map[EncodedCompoundIdentifier]DeclInfo

type DeclType

type DeclType string
const (
	LibraryDeclType DeclType = "library"

	ConstDeclType    DeclType = "const"
	BitsDeclType     DeclType = "bits"
	EnumDeclType     DeclType = "enum"
	ProtocolDeclType DeclType = "interface"
	ServiceDeclType  DeclType = "service"
	StructDeclType   DeclType = "struct"
	TableDeclType    DeclType = "table"
	UnionDeclType    DeclType = "union"

	// TODO(fxbug.dev/50195): This is for backward compatibility with fidlgen_dart in
	// Topaz, and should be removed after fidlgen_dart code has been updated.
	InterfaceDeclType DeclType = "interface"
)

func (DeclType) IsPrimitive

func (dt DeclType) IsPrimitive() bool

type EncodedCompoundIdentifier

type EncodedCompoundIdentifier string

func (EncodedCompoundIdentifier) DeclName

func (EncodedCompoundIdentifier) LibraryName

func (EncodedCompoundIdentifier) Parts

type EncodedLibraryIdentifier

type EncodedLibraryIdentifier string

func (EncodedLibraryIdentifier) Parts

func (EncodedLibraryIdentifier) PartsReversed

func (eli EncodedLibraryIdentifier) PartsReversed() []string

type Enum

type Enum struct {
	Attributes
	Type            PrimitiveSubtype          `json:"type"`
	Name            EncodedCompoundIdentifier `json:"name"`
	Members         []EnumMember              `json:"members"`
	Strictness      `json:"strict"`
	RawUnknownValue int64OrUint64 `json:"maybe_unknown_value"`
}

Enum represents a FIDL declaration of an enum.

func (*Enum) UnknownValueAsInt64

func (enum *Enum) UnknownValueAsInt64() (int64, error)

UnknownValueAsInt64 retrieves the unknown value. Succeeds only for signed flexible enums.

func (*Enum) UnknownValueAsUint64

func (enum *Enum) UnknownValueAsUint64() (uint64, error)

UnknownValueAsUint64 retrieves the unknown value. Succeeds only for unsigned flexible enums.

func (*Enum) UnknownValueForTmpl

func (enum *Enum) UnknownValueForTmpl() interface{}

UnknownValueForTmpl retrieves the signed or unsigned unknown value. Panics if called on a strict enum.

type EnumMember

type EnumMember struct {
	Attributes
	Name  Identifier `json:"name"`
	Value Constant   `json:"value"`
}

EnumMember represents a single variant in a FIDL enum.

func (*EnumMember) IsUnknown

func (member *EnumMember) IsUnknown() bool

IsUnknown indicates whether this member represents a custom unknown flexible enum member.

type FieldShape

type FieldShape struct {
	Offset  int `json:"offset"`
	Padding int `json:"padding"`
}

FieldShape represents the shape of the field on the wire. See JSON IR schema, e.g. fidlc --json-schema

type Formatter

type Formatter struct {
	// contains filtered or unexported fields
}

Formatter formats a writer stream.

func NewFormatter

func NewFormatter(path string, args ...string) Formatter

NewFormatter creates a new formatter.

The `path` needs to either * Point to an executable which formats stdin and outputs it to stdout; * An empty string, in which case no formatting will occur.

func (Formatter) FormatPipe

func (f Formatter) FormatPipe(out io.WriteCloser) (io.WriteCloser, error)

FormatPipe formats an output stream.

If there is a error during formatting, the unformatted input will be written and an error will be returned.

When the returned WriteCloser is closed, 'out' will also be closed. This allows the caller to close the writer in a single location and received all relevant errors.

type HandleRights

type HandleRights uint32
const (
	HandleRightsNone HandleRights = 0

	HandleRightsDuplicate     HandleRights = 1 << 0
	HandleRightsTransfer      HandleRights = 1 << 1
	HandleRightsRead          HandleRights = 1 << 2
	HandleRightsWrite         HandleRights = 1 << 3
	HandleRightsExecute       HandleRights = 1 << 4
	HandleRightsMap           HandleRights = 1 << 5
	HandleRightsGetProperty   HandleRights = 1 << 6
	HandleRightsSetProperty   HandleRights = 1 << 7
	HandleRightsEnumerate     HandleRights = 1 << 8
	HandleRightsDestroy       HandleRights = 1 << 9
	HandleRightsSetPolicy     HandleRights = 1 << 10
	HandleRightsGetPolicy     HandleRights = 1 << 11
	HandleRightsSignal        HandleRights = 1 << 12
	HandleRightsSignalPeer    HandleRights = 1 << 13
	HandleRightsWait          HandleRights = 1 << 14
	HandleRightsInspect       HandleRights = 1 << 15
	HandleRightsManageJob     HandleRights = 1 << 16
	HandleRightsManageProcess HandleRights = 1 << 17
	HandleRightsManageThread  HandleRights = 1 << 18
	HandleRightsApplyProfile  HandleRights = 1 << 19

	HandleRightsSameRights HandleRights = 1 << 31

	HandleRightsBasic HandleRights = HandleRightsTransfer | HandleRightsDuplicate | HandleRightsWait | HandleRightsInspect
)

type HandleSubtype

type HandleSubtype string
const (
	Handle       HandleSubtype = "handle"
	Bti          HandleSubtype = "bti"
	Channel      HandleSubtype = "channel"
	Clock        HandleSubtype = "clock"
	DebugLog     HandleSubtype = "debuglog"
	Event        HandleSubtype = "event"
	Eventpair    HandleSubtype = "eventpair"
	Exception    HandleSubtype = "exception"
	Fifo         HandleSubtype = "fifo"
	Guest        HandleSubtype = "guest"
	Interrupt    HandleSubtype = "interrupt"
	Iommu        HandleSubtype = "iommu"
	Job          HandleSubtype = "job"
	Pager        HandleSubtype = "pager"
	PciDevice    HandleSubtype = "pcidevice"
	Pmt          HandleSubtype = "pmt"
	Port         HandleSubtype = "port"
	Process      HandleSubtype = "process"
	Profile      HandleSubtype = "profile"
	Resource     HandleSubtype = "resource"
	Socket       HandleSubtype = "socket"
	Stream       HandleSubtype = "stream"
	SuspendToken HandleSubtype = "suspendtoken"
	Thread       HandleSubtype = "thread"
	Time         HandleSubtype = "timer"
	Vcpu         HandleSubtype = "vcpu"
	Vmar         HandleSubtype = "vmar"
	Vmo          HandleSubtype = "vmo"
)

type Identifier

type Identifier string

type Interface

type Interface = Protocol

TODO(fxbug.dev/50195): This is for backward compatibility with fidlgen_dart in Topaz, and should be removed after fidlgen_dart code has been updated.

type LazyWriter

type LazyWriter struct {
	// contains filtered or unexported fields
}

func NewLazyWriter

func NewLazyWriter(destination string) (*LazyWriter, error)

func (*LazyWriter) Close

func (lw *LazyWriter) Close() error

func (*LazyWriter) Write

func (lw *LazyWriter) Write(p []byte) (n int, err error)

type Library

type Library struct {
	Name  EncodedLibraryIdentifier `json:"name,omitempty"`
	Decls DeclInfoMap              `json:"declarations,omitempty"`
}

Library represents a FIDL dependency on a separate library.

type LibraryIdentifier

type LibraryIdentifier []Identifier

func (LibraryIdentifier) Encode

type LibraryName

type LibraryName struct {
	// contains filtered or unexported fields
}

LibraryName represents a FIDL library name, such as `fuchsia.mem` or `fuchsia.ui.scenic`.

func MustReadLibraryName

func MustReadLibraryName(fullyQualifiedName string) LibraryName

MustReadLibraryName reads a library name from a fully qualified name, and panics in case of error.

See https://fuchsia.dev/fuchsia-src/development/languages/fidl/reference/ftp/ftp-043#fully_qualified_names

func ReadLibraryName

func ReadLibraryName(fullyQualifiedName string) (LibraryName, error)

ReadLibraryName reads a library name from a fully qualified name.

See https://fuchsia.dev/fuchsia-src/development/languages/fidl/reference/ftp/ftp-043#fully_qualified_names

func (LibraryName) FullyQualifiedName

func (name LibraryName) FullyQualifiedName() string

FullyQualifiedName returns the fully qualified name, e.g. `fuchsia.mem` or `fuchsia.ui.scenic`.

See https://fuchsia.dev/fuchsia-src/development/languages/fidl/reference/ftp/ftp-043#fully_qualified_names

func (LibraryName) Parts

func (name LibraryName) Parts() []string

Parts returns the library name in parts, e.g. `fuchsia`, `mem` or `fuchsia`, `ui`, `scenic`.

type Literal

type Literal struct {
	Kind  LiteralKind `json:"kind"`
	Value string      `json:"value,omitempty"`
}

type LiteralKind

type LiteralKind string
const (
	StringLiteral  LiteralKind = "string"
	NumericLiteral LiteralKind = "numeric"
	TrueLiteral    LiteralKind = "true"
	FalseLiteral   LiteralKind = "false"
	DefaultLiteral LiteralKind = "default"
)

type Method

type Method struct {
	Attributes
	Ordinal             uint64                    `json:"ordinal"`
	Name                Identifier                `json:"name"`
	HasRequest          bool                      `json:"has_request"`
	Request             []Parameter               `json:"maybe_request,omitempty"`
	RequestPayload      EncodedCompoundIdentifier `json:"maybe_request_payload,omitempty"`
	RequestTypeShapeV1  TypeShape                 `json:"maybe_request_type_shape_v1,omitempty"`
	RequestPadding      bool                      `json:"maybe_request_has_padding,omitempty"`
	RequestFlexible     bool                      `json:"experimental_maybe_request_has_flexible_envelope,omitempty"`
	HasResponse         bool                      `json:"has_response"`
	Response            []Parameter               `json:"maybe_response,omitempty"`
	ResponsePayload     EncodedCompoundIdentifier `json:"maybe_response_payload,omitempty"`
	ResponseTypeShapeV1 TypeShape                 `json:"maybe_response_type_shape_v1,omitempty"`
	ResponsePadding     bool                      `json:"maybe_response_has_padding,omitempty"`
	ResponseFlexible    bool                      `json:"experimental_maybe_response_has_flexible_envelope,omitempty"`
}

Method represents the declaration of a FIDL method.

func (*Method) IsTransitional

func (m *Method) IsTransitional() bool

IsTransitional returns whether this method has the `Transitional` attribute.

type Name

type Name struct {
	// contains filtered or unexported fields
}

Name represents a FIDL declaration name, consisting of a FIDL library, and a FIDL declration such as `fuchsia.mem` and `Buffer`.

func MustReadName

func MustReadName(fullyQualifiedName string) Name

MustReadName reads a name from a fully qualified name, and panics in case of error.

See https://fuchsia.dev/fuchsia-src/development/languages/fidl/reference/ftp/ftp-043#fully_qualified_names

func ReadName

func ReadName(fullyQualifiedName string) (Name, error)

ReadName reads a name from a fully qualified name.

See https://fuchsia.dev/fuchsia-src/development/languages/fidl/reference/ftp/ftp-043#fully_qualified_names

func (Name) DeclarationName

func (name Name) DeclarationName() string

DeclarationName returns the declaration name, e.g. `Buffer`.

func (Name) FullyQualifiedName

func (name Name) FullyQualifiedName() string

FullyQualifiedName returns the fully qualified name, e.g. `fuchsia.mem/Buffer`.

See https://fuchsia.dev/fuchsia-src/development/languages/fidl/reference/ftp/ftp-043#fully_qualified_names

func (Name) LibraryName

func (name Name) LibraryName() LibraryName

LibraryName returns the library name, e.g. `fuchsia.mem`.

type ObjectType

type ObjectType uint32

TODO(fxb/64629): Remove, source of truth is library zx.

One complication is that GIDL parses nice handle subtypes in its grammar, e.g. `#0 = event(rights: execute + write )`. And some GIDL backends care about the object type. This means that we need to duplicate this mapping :/ It would be cleaner to limit this to GIDL and GIDL backends, rather than offer that in the general purpose lib/fidlgen.

func ObjectTypeFromHandleSubtype

func ObjectTypeFromHandleSubtype(val HandleSubtype) ObjectType

type Parameter

type Parameter struct {
	Type         Type       `json:"type"`
	Name         Identifier `json:"name"`
	MaxHandles   int        `json:"max_handles"`
	MaxOutOfLine int        `json:"max_out_of_line"`
	FieldShapeV1 FieldShape `json:"field_shape_v1"`
}

Parameter represents a parameter to a FIDL method.

type PrimitiveSubtype

type PrimitiveSubtype string
const (
	Bool    PrimitiveSubtype = "bool"
	Int8    PrimitiveSubtype = "int8"
	Int16   PrimitiveSubtype = "int16"
	Int32   PrimitiveSubtype = "int32"
	Int64   PrimitiveSubtype = "int64"
	Uint8   PrimitiveSubtype = "uint8"
	Uint16  PrimitiveSubtype = "uint16"
	Uint32  PrimitiveSubtype = "uint32"
	Uint64  PrimitiveSubtype = "uint64"
	Float32 PrimitiveSubtype = "float32"
	Float64 PrimitiveSubtype = "float64"
)

func (PrimitiveSubtype) IsSigned

func (typ PrimitiveSubtype) IsSigned() bool

IsSigned indicates whether this subtype represents a signed number such as `int16`, or `float32`.

func (PrimitiveSubtype) IsUnsigned

func (typ PrimitiveSubtype) IsUnsigned() bool

IsUnsigned indicates whether this subtype represents an unsigned number such as `uint16`.

type Protocol

type Protocol struct {
	Attributes
	Name    EncodedCompoundIdentifier `json:"name"`
	Methods []Method                  `json:"methods"`
}

Protocol represents the declaration of a FIDL protocol.

func (*Protocol) GetServiceName

func (d *Protocol) GetServiceName() string

type Resourceness

type Resourceness bool

Resourceness represents whether a FIDL object may contain any resource types, such as handles. See https://fuchsia.dev/fuchsia-src/contribute/governance/fidl/ftp/ftp-057 for more information.

const (
	IsResourceType Resourceness = true
	IsValueType    Resourceness = false
)

func (Resourceness) IsResourceType

func (r Resourceness) IsResourceType() bool

IsResourceType indicates whether this type is marked as a resource type

func (Resourceness) IsValueType

func (r Resourceness) IsValueType() bool

IsValueType indicates whether this type is not marked as a resource type

type Root

type Root struct {
	Name      EncodedLibraryIdentifier    `json:"name,omitempty"`
	Consts    []Const                     `json:"const_declarations,omitempty"`
	Bits      []Bits                      `json:"bits_declarations,omitempty"`
	Enums     []Enum                      `json:"enum_declarations,omitempty"`
	Protocols []Protocol                  `json:"interface_declarations,omitempty"`
	Services  []Service                   `json:"service_declarations,omitempty"`
	Structs   []Struct                    `json:"struct_declarations,omitempty"`
	Tables    []Table                     `json:"table_declarations,omitempty"`
	Unions    []Union                     `json:"union_declarations,omitempty"`
	DeclOrder []EncodedCompoundIdentifier `json:"declaration_order,omitempty"`
	Decls     DeclMap                     `json:"declarations,omitempty"`
	Libraries []Library                   `json:"library_dependencies,omitempty"`

	// TODO(fxbug.dev/50195): This is for backward compatibility with fidlgen_dart in
	// Topaz, and should be removed after fidlgen_dart code has been updated.
	Interfaces []Protocol
}

Root is the top-level object for a FIDL library. It contains lists of all declarations and dependencies within the library.

func DecodeJSONIr

func DecodeJSONIr(r io.Reader) (Root, error)

DecodeJSONIr reads the JSON content from a reader.

func ReadJSONIr

func ReadJSONIr(filename string) (Root, error)

ReadJSONIr reads a JSON IR file.

func ReadJSONIrContent

func ReadJSONIrContent(b []byte) (Root, error)

ReadJSONIrContent reads JSON IR content.

func (*Root) DeclsWithDependencies

func (r *Root) DeclsWithDependencies() DeclInfoMap

DeclsWithDependencies returns a single DeclInfoMap containing the FIDL library's declarations and those of its dependencies.

func (*Root) ForBindings

func (r *Root) ForBindings(language string) Root

ForBindings filters out declarations that should be omitted in the given language bindings based on BindingsDenylist attributes. It returns a new Root and does not modify r.

type Service

type Service struct {
	Attributes
	Name    EncodedCompoundIdentifier `json:"name"`
	Members []ServiceMember           `json:"members"`
}

Service represents the declaration of a FIDL service.

func (*Service) GetServiceName

func (s *Service) GetServiceName() string

type ServiceMember

type ServiceMember struct {
	Attributes
	Name Identifier `json:"name"`
	Type Type       `json:"type"`
}

ServiceMember represents the declaration of a field in a FIDL service.

type Strictness

type Strictness bool

Strictness represents whether a FIDL object is strict or flexible. See <https://fuchsia.dev/fuchsia-src/development/languages/fidl/reference/ftp/ftp-033> for more information.

const (
	IsFlexible Strictness = false
	IsStrict   Strictness = true
)

func (Strictness) IsFlexible

func (s Strictness) IsFlexible() bool

IsFlexible indicates whether this type is flexible.

func (Strictness) IsStrict

func (s Strictness) IsStrict() bool

IsStrict indicates whether this type is strict.

type Struct

type Struct struct {
	Attributes
	Name         EncodedCompoundIdentifier `json:"name"`
	Anonymous    bool                      `json:"anonymous"`
	Members      []StructMember            `json:"members"`
	Resourceness `json:"resource"`
	TypeShapeV1  TypeShape `json:"type_shape_v1"`
}

Struct represents a declaration of a FIDL struct.

type StructMember

type StructMember struct {
	Attributes
	Type              Type       `json:"type"`
	Name              Identifier `json:"name"`
	MaybeDefaultValue *Constant  `json:"maybe_default_value,omitempty"`
	MaxHandles        int        `json:"max_handles"`
	FieldShapeV1      FieldShape `json:"field_shape_v1"`
}

StructMember represents the declaration of a field in a FIDL struct.

func EmptyStructMember

func EmptyStructMember(name string) StructMember

EmptyStructMember returns a StructMember that's suitable as the sole member of an empty struct.

type Table

type Table struct {
	Attributes
	Name         EncodedCompoundIdentifier `json:"name"`
	Members      []TableMember             `json:"members"`
	Resourceness `json:"resource"`
	TypeShapeV1  TypeShape `json:"type_shape_v1"`
}

Table represents a declaration of a FIDL table.

func (*Table) SortedMembersNoReserved

func (t *Table) SortedMembersNoReserved() []TableMember

SortedMembersNoReserved returns the table's members sorted by ordinal, excluding reserved members.

type TableMember

type TableMember struct {
	Attributes
	Reserved          bool       `json:"reserved"`
	Type              Type       `json:"type"`
	Name              Identifier `json:"name"`
	Ordinal           int        `json:"ordinal"`
	MaybeDefaultValue *Constant  `json:"maybe_default_value,omitempty"`
	MaxOutOfLine      int        `json:"max_out_of_line"`
}

TableMember represents the declaration of a field in a FIDL table.

type Type

type Type struct {
	Kind             TypeKind
	ElementType      *Type
	ElementCount     *int
	HandleSubtype    HandleSubtype
	HandleRights     HandleRights
	RequestSubtype   EncodedCompoundIdentifier
	PrimitiveSubtype PrimitiveSubtype
	Identifier       EncodedCompoundIdentifier
	Nullable         bool
	ObjType          uint32
}

func (*Type) UnmarshalJSON

func (t *Type) UnmarshalJSON(b []byte) error

UnmarshalJSON customizes the JSON unmarshalling for Type.

type TypeKind

type TypeKind string
const (
	ArrayType      TypeKind = "array"
	VectorType     TypeKind = "vector"
	StringType     TypeKind = "string"
	HandleType     TypeKind = "handle"
	RequestType    TypeKind = "request"
	PrimitiveType  TypeKind = "primitive"
	IdentifierType TypeKind = "identifier"
)

type TypeShape

type TypeShape struct {
	InlineSize          int  `json:"inline_size"`
	Alignment           int  `json:"alignment"`
	Depth               int  `json:"depth"`
	MaxHandles          int  `json:"max_handles"`
	MaxOutOfLine        int  `json:"max_out_of_line"`
	HasPadding          bool `json:"has_padding"`
	HasFlexibleEnvelope bool `json:"has_flexible_envelope"`
}

TypeShape represents the shape of the type on the wire. See JSON IR schema, e.g. fidlc --json-schema

type Union

type Union struct {
	Attributes
	Name         EncodedCompoundIdentifier `json:"name"`
	Members      []UnionMember             `json:"members"`
	Strictness   `json:"strict"`
	Resourceness `json:"resource"`
	TypeShapeV1  TypeShape `json:"type_shape_v1"`
}

Union represents the declaration of a FIDL union.

type UnionMember

type UnionMember struct {
	Attributes
	Reserved     bool       `json:"reserved"`
	Ordinal      int        `json:"ordinal"`
	Type         Type       `json:"type"`
	Name         Identifier `json:"name"`
	Offset       int        `json:"offset"`
	MaxOutOfLine int        `json:"max_out_of_line"`
}

UnionMember represents the declaration of a field in a FIDL extensible union.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL