Crate gidl_util

Source
Expand description

This crate contains utility functions used in GIDL tests and benchmarks.

Structs§

HandleDef
Specifies a handle to be created with create_handles. Corresponds to HandleDef in //tools/fidl/gidl/ir/test_case.go.

Enums§

HandleSubtype
Handle subtypes that can be created via create_handles. Each subtype X corresponds to a fidl::X type that implements HandleBased.

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 topic ZX_INFO_HANDLE_VALID. In particular, returns Status::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 repeated len times.
select_handle_infos
Copies raw handles from the given indices to a new vector of owned HandleInfos. 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 raw zx_handle_disposition_t.