pub async fn mock_component<S, Event: 'static>(
    sender: mpsc::Sender<Event>,
    handles: MockHandles,
) -> Result<(), Error>
where
    S: DiscoverableService,
    Event: std::convert::From<<<S as ServiceMarker>::RequestStream as TryStream>::Ok>
        + std::marker::Send,
    <<S as ServiceMarker>::RequestStream as TryStream>::Ok: std::fmt::Debug,
{
    let mut fs = ServiceFs::new();
    fs.dir("svc").add_fidl_service(move |req_stream: S::RequestStream| {
        let sender_clone = sender.clone();
        fasync::Task::local(process_request_stream::<S, _>(req_stream, sender_clone)).detach();
    });

    fs.serve_connection(handles.outgoing_dir.into_channel())?;
    fs.collect::<()>().await;
    Ok(())
}
/// A mock component that provides the generic service `S`. The request stream
/// of the service is processed and any requests relayed to the provided `sender`.
A mock component that provides the generic service `S`. The request stream
of the service is processed and any requests relayed to the provided `sender`.
A mock component that provides the generic service ` S ` . The request stream of the service is processed and any requests relayed to the provided ` sender ` .
pub async fn mock_component<S, Event: 'static>(
    sender: mpsc::Sender<Event>,
    handles: MockHandles,
) -> Result<(), Error>
where
    S: DiscoverableService,
    Event: std::convert::From<<<S as ServiceMarker>::RequestStream as TryStream>::Ok>
        + std::marker::Send,
    <<S as ServiceMarker>::RequestStream as TryStream>::Ok: std::fmt::Debug,
{
    let mut fs = ServiceFs::new();
    fs.dir("svc").add_fidl_service(move |req_stream: S::RequestStream| {
        let sender_clone = sender.clone();
        fasync::Task::local(process_request_stream::<S, _>(req_stream, sender_clone)).detach();
    });
    fs.serve_connection(handles.outgoing_dir.into_channel())?;
    fs.collect::<()>().await;
    Ok(())
}
pub async fn mock_component < S , Event : ' static > ( sender : mpsc :: Sender < Event > , handles : MockHandles , ) -> Result < ( ) , Error > where S : DiscoverableService , Event : std :: convert :: From < < < S as ServiceMarker > :: RequestStream as TryStream > :: Ok > + std :: marker :: Send , < < S as ServiceMarker > :: RequestStream as TryStream > :: Ok : std :: fmt :: Debug , { let mut fs = ServiceFs :: new ( ) ; fs . dir ( " " ) . add_fidl_service ( move | req_stream : S :: RequestStream | { let sender_clone = sender . clone ( ) ; fasync :: Task :: local ( process_request_stream :: < S , _ > ( req_stream , sender_clone ) ) . detach ( ) ; } ) ; fs . serve_connection ( handles . outgoing_dir . into_channel ( ) ) ? ; fs . collect :: < ( ) > ( ) . await ; Ok ( ( ) ) }
A mock component that provides the generic service `S`.
A mock component that provides the generic service ` S ` .
sender
mpsc::Sender<Event>
handles
MockHandles
sender
mpsc::Sender<Event>
handles
MockHandles