Expand description
This crate contains utility functions used in GIDL tests and benchmarks.
Structs§
- Handle
Def - Specifies a handle to be created with
create_handles
. Corresponds toHandleDef
in //tools/fidl/gidl/ir/test_case.go.
Enums§
- Handle
Subtype - Handle subtypes that can be created via
create_handles
. Each subtypeX
corresponds to afidl::X
type that implementsHandleBased
.
Functions§
- copy_
handle - Copies a raw handle into an owned
HandleBased
handle. - create_
handles - Creates a vector of raw handles based on
defs
. Panics if creating any of the handles fails. The caller is responsible for closing the handles. - decode_
value - Decodes
T
from the given bytes and handles. Panics on failure. - get_
handle_ koid - Gets the koid of a handle from its raw handle info. Panics if the
zx_object_get_info
syscall fails. - get_
info_ handle_ valid - Returns the result of the
zx_object_get_info
syscall with topicZX_INFO_HANDLE_VALID
. In particular, returnsStatus::BAD_HANDLE
if the handle is dangling because it was already closed or never assigned to the process in the first place. - repeat
- Returns a vector of
value
repeatedlen
times. - select_
handle_ infos - Copies raw handles from the given indices to a new vector of owned
HandleInfo
s. The caller must ensure handles are closed exactly once. - select_
raw_ handle_ infos - Copies raw handles from the given indices to a new vector.
- to_
zx_ handle_ disposition_ t - Converts a
HandleDisposition
to a rawzx_handle_disposition_t
.