Crate gidl_util

source ·
Expand description

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


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


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


  • Copies a raw handle into an owned HandleBased handle.
  • 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.
  • Decodes T from the given bytes and handles. Panics on failure.
  • Gets the koid of a handle from its raw handle info. Panics if the zx_object_get_info syscall fails.
  • 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.
  • Returns a vector of value repeated len times.
  • Copies raw handles from the given indices to a new vector of owned HandleInfos. The caller must ensure handles are closed exactly once.
  • Copies raw handles from the given indices to a new vector.
  • Converts a HandleDisposition to a raw zx_handle_disposition_t.
  • Converts a HandleDisposition to a raw zx_handle_t.