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
- Create a header with
TransactionHeader::new
. - Use one of the
encode_*
methods to encode the message.
§Decoding
- Decode the header with
decode_transaction_header
. - Use one of the
decode_*
methods to decode the message body.
Structs§
- Dynamic
Flags - Bitflags type to flags that aid in dynamically identifying features of the request.
- Transaction
Header - Header for transactional FIDL messages
Enums§
- Maybe
Unknown - 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
. - Error
Type - 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
andbody
come fromdecode_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
andbody
come fromdecode_transaction_header
. - decode_
response_ flexible_ result - Decodes a FIDL response body for a flexible two-way method with error syntax.
Assumes
header
andbody
come fromdecode_transaction_header
. - decode_
response_ strict_ result - Decodes a FIDL response body for a flexible two-way method with error syntax.
Assumes
header
andbody
come fromdecode_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).