mock_paver

Trait Hook

Source
pub trait Hook: Sync {
    // Provided methods
    fn boot_manager<'life0, 'async_trait>(
        &'life0 self,
        request: BootManagerRequest,
    ) -> Pin<Box<dyn Future<Output = Option<BootManagerRequest>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn data_sink<'life0, 'async_trait>(
        &'life0 self,
        request: DataSinkRequest,
    ) -> Pin<Box<dyn Future<Output = Option<DataSinkRequest>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A Hook gives tests the opportunity to directly respond to a request, mock-style.

If a Hook wants to respond to a request, it should send a response on the request’s Responder, and then return None. If the Hook wants to pass the request on to the next Hook, it should do so by returning Some(the_request_it_got).

Unimplemented methods pass on all requests.

Responding to requests with the fidl bindings can be kind of unwieldy, so see the hooks module for tidier syntax in simpler cases.

Provided Methods§

Source

fn boot_manager<'life0, 'async_trait>( &'life0 self, request: BootManagerRequest, ) -> Pin<Box<dyn Future<Output = Option<BootManagerRequest>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn data_sink<'life0, 'async_trait>( &'life0 self, request: DataSinkRequest, ) -> Pin<Box<dyn Future<Output = Option<DataSinkRequest>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§