async fn handle_host_events(harness: HostDriverHarness) -> Result<(), Error> {
    let mut events = harness.aux().proxy().take_event_stream();

    while let Some(e) = events.try_next().await? {
        match e {
            HostEvent::OnDeviceUpdated { device } => {
                harness.write_state().peers.insert(device.identifier.clone(), device);
            }
            HostEvent::OnDeviceRemoved { identifier } => {
                harness.write_state().peers.remove(&identifier);
            }
            // TODO(armansito): handle other events
            e => {
                eprintln!("Unhandled event: {:?}", e);
            }
        }
        harness.notify_state_changed();
    }

    Ok(())
}
// Returns a Future that handles Host interface events.
Returns a Future that handles Host interface events.
Returns a Future that handles Host interface events .
async fn handle_host_events(harness: HostDriverHarness) -> Result<(), Error> {
    let mut events = harness.aux().proxy().take_event_stream();
    while let Some(e) = events.try_next().await? {
        match e {
            HostEvent::OnDeviceUpdated { device } => {
                harness.write_state().peers.insert(device.identifier.clone(), device);
            }
            HostEvent::OnDeviceRemoved { identifier } => {
                harness.write_state().peers.remove(&identifier);
            }
            // TODO(armansito): handle other events
            e => {
                eprintln!("Unhandled event: {:?}", e);
            }
        }
        harness.notify_state_changed();
    }
    Ok(())
}
async fn handle_host_events ( harness : HostDriverHarness ) -> Result < ( ) , Error > { let mut events = harness . aux ( ) . proxy ( ) . take_event_stream ( ) ; while let Some ( e ) = events . try_next ( ) . await ? { match e { HostEvent :: OnDeviceUpdated { device } => { harness . write_state ( ) . peers . insert ( device . identifier . clone ( ) , device ) ; } HostEvent :: OnDeviceRemoved { identifier } => { harness . write_state ( ) . peers . remove ( & identifier ) ; } // TODO(armansito): handle other events e => { eprintln ! ( " " e ) ; } } harness . notify_state_changed ( ) ; } Ok ( ( ) ) }
Returns a Future that handles Host interface events.
Returns a Future that handles Host interface events .
harness
HostDriverHarness