blob: 1bacc863d8910a0db35f3e5eef94ebdd05247efe [file] [log] [blame]
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package fidl
import "syscall/zx"
// Enum is implemented by any value that is a FIDL enum.
//
// During code generation, `fidlgen_go` ensures that all domain types generated
// to represent FIDL enum implement this interface.
type Enum interface {
// IsUnknown indicates whether this enum value is unknown, i.e. whether it
// falls outside of known FIDL enum members.
//
// While strict FIDL enums ensure that no unknown enums can be decoded, it
// is still possible to construct an unknown enum by casting a primitive
// value.
IsUnknown() bool
}
// Bits is implemented by any value that is a FIDL bits type.
//
// During code generation, `fidlgen_go` ensures that all domain types generated
// to represent FIDL bits implement this interface.
//
// While strict FIDL bits ensure that no unknown bits can be decoded, it
// is still possible to construct a bits value with unknown bits by casting
// a primitive value.
type Bits interface {
// HasUnknownBits indicates whether this bits value contains any unknown
// bits
HasUnknownBits() bool
// GetUnknownBits returns a uint64 containing only the unknown bits
GetUnknownBits() uint64
}
// UnknownData represents the raw bytes and handles of an unknown payload
type UnknownData struct {
Bytes []byte
Handles []zx.HandleInfo
}