Skip to main content

Response

Trait Response 

Source
pub trait Response {
    type Payload;

    // Required method
    fn into_payload<D>(decoded: Decoded<Self, D>) -> Decoded<Self::Payload, D>;
}
Expand description

A protocol response message.

Two-way FIDL responses can be strict or flexible, and flexible responses wrap their responses in a FIDL union. This means that strict and flexible FIDL responses have different wire formats even though we treat flexible errors as protocol errors. So the protocol and bind layers get a little mixed up here.

To solve this, FIDL response types implement this Response trait and define how to “unwrap” themselves into their decoded Payload types. This eliminates an unnecessary .0 field access that we’d have to do otherwise.

Required Associated Types§

Source

type Payload

The payload of the response.

Required Methods§

Source

fn into_payload<D>(decoded: Decoded<Self, D>) -> Decoded<Self::Payload, D>

Converts a Decoded of this type to a Decoded of its payload type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Response for Flexible<'_, T>

Source§

impl<T> Response for Strict<T>

Source§

impl<T, E> Response for Result<'_, T, E>

Source§

type Payload = Result<'_, T, E>