Crate fidl_message

source ·
Expand description

This module provides an API for encoding and decoding FIDL transaction messages directly, without using protocol bindings or Zircon channels. The messages must be value types (no handles).

§Usage

§Encoding

  1. Create a header with TransactionHeader::new.
  2. Use one of the encode_* methods to encode the message.

§Decoding

  1. Decode the header with decode_transaction_header.
  2. Use one of the decode_* methods to decode the message body.

Structs§

  • Bitflags type to flags that aid in dynamically identifying features of the request.
  • Header for transactional FIDL messages

Enums§

  • Return type for functions that decode flexible responses.

Traits§

  • A trait for types that can be a FIDL request/response body. This is implemented for () and FIDL structs, tables, and unions. Implementation of fidl_message::Body.
  • A trait for types that can be the domain error variant of a FIDL response. This only applies to two-way methods that use error syntax. This is implemented for primitives and user-defined FIDL types. Implementation of fidl_message::ErrorType.

Functions§

  • Decodes a FIDL transaction message body (request or response). Assumes header and body come from decode_transaction_header. Use this for one-way methods, events, and two-way method requests. For two-way method responses:
  • Decodes a FIDL response body for a flexible two-way method without error syntax. Assumes header and body come from decode_transaction_header.
  • Decodes a FIDL response body for a flexible two-way method with error syntax. Assumes header and body come from decode_transaction_header.
  • Decodes a FIDL response body for a flexible two-way method with error syntax. Assumes header and body come from decode_transaction_header.
  • Decodes the transaction header from a message. Returns the header and a reference to the tail of the message.
  • Encodes a FIDL transaction message (request or response). Use this for one-way methods, events, and two-way method requests. For two-way method responses:
  • Encodes a FIDL transaction response for a flexible two-way method without error syntax. Wraps the body in a result union set to ordinal 1 (success).
  • Encodes a FIDL transaction response for a flexible two-way method, for use in an open protocol when the method is unknown to the server.
  • Encodes a FIDL transaction response for a two-way method with error syntax. Wraps the body in a result union set to ordinal 1 (Ok) or 2 (Err).