Trait wlan_fidl_ext::responder_ext::ResponderExt

source ·
pub trait ResponderExt {
    type Response;

    const REQUEST_NAME: &'static str;

    // Required method
    fn send(self, response: Self::Response) -> Result<(), Error>;

    // Provided methods
    fn unpack_fields_or_else_send<T, F>(
        self,
        fields: T,
        f: F,
    ) -> Result<(T::Unpacked, Self), Error>
       where T: TryUnpack<Error = Error>,
             F: FnOnce() -> Self::Response,
             Self: Sized { ... }
    fn unpack_fields_or_respond<T>(
        self,
        fields: T,
    ) -> Result<(T::Unpacked, Self), Error>
       where T: TryUnpack<Error = Error>,
             Self: ResponderExt<Response = ()> + Sized { ... }
}
Expand description

Defines an abstract ResponderExt trait usually implemented using the impl_responder_ext!() macro.

Required Associated Types§

Required Associated Constants§

source

const REQUEST_NAME: &'static str

Required Methods§

source

fn send(self, response: Self::Response) -> Result<(), Error>

Provided Methods§

source

fn unpack_fields_or_else_send<T, F>( self, fields: T, f: F, ) -> Result<(T::Unpacked, Self), Error>
where T: TryUnpack<Error = Error>, F: FnOnce() -> Self::Response, Self: Sized,

Returns an success value containing all unpacked fields and the responder, or an error value if any of the values in fields is missing.

The last argument is a closure which will compute a Self::Response. If any field is missing a value, then this function will return an error and send the computed Self::Response.

Example Usage:

  enum Error {
      UnableToStart,
  }
  let ((status, id), responder) = responder.unpack_fields_or_else_send(
      (payload.status.with_name("status"), payload.id.with_name("id")),
      |e| (e.context(format_err!("Unable to start.")), Error::UnableToStart),
  )?;
source

fn unpack_fields_or_respond<T>( self, fields: T, ) -> Result<(T::Unpacked, Self), Error>
where T: TryUnpack<Error = Error>, Self: ResponderExt<Response = ()> + Sized,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl ResponderExt for WlanSoftmacIfcBridgeNotifyScanCompleteResponder

§

type Response = ()

source§

const REQUEST_NAME: &'static str = "fidl_softmac::WlanSoftmacIfcBaseNotifyScanCompleteRequest"

source§

fn send(self, _: Self::Response) -> Result<(), Error>

source§

impl ResponderExt for WlanSoftmacIfcBridgeReportTxResultResponder

§

type Response = ()

source§

const REQUEST_NAME: &'static str = "fidl_softmac::WlanSoftmacIfcBaseReportTxResultRequest"

source§

fn send(self, _: Self::Response) -> Result<(), Error>

Implementors§