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§

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

Enums§

MaybeUnknown
Return type for functions that decode flexible responses.

Traits§

Body
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.
Decode
A Rust type that can be decoded from the FIDL type T.
ErrorType
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§

decode_message
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:
decode_response_flexible
Decodes a FIDL response body for a flexible two-way method without error syntax. Assumes header and body come from decode_transaction_header.
decode_response_flexible_result
Decodes a FIDL response body for a flexible two-way method with error syntax. Assumes header and body come from decode_transaction_header.
decode_response_strict_result
Decodes a FIDL response body for a flexible two-way method with error syntax. Assumes header and body come from decode_transaction_header.
decode_transaction_header
Decodes the transaction header from a message. Returns the header and a reference to the tail of the message.
encode_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:
encode_response_flexible
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).
encode_response_flexible_unknown
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.
encode_response_result
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).