/// Makes a call to the TargetCollection (similar to `ffx target show`) to see if it has a target
/// that matches the specified emulator. If the emulator responds to the request, such that a
/// handle is returned, it's considered "active".
///
/// The request documentation indicates that the call to OpenTarget will hang until the device
/// responds, possibly indefinitely. We wrap the call in a timeout of 1 second, so this function
/// will not hang indefinitely. If the caller expects the response to take longer (such as during
/// Fuchsia bootup), it's safe to call the function repeatedly with a longer local timeout.
Makes a call to the TargetCollection (similar to `ffx target show`) to see if it has a target
that matches the specified emulator. If the emulator responds to the request, such that a
handle is returned, it's considered "active".

The request documentation indicates that the call to OpenTarget will hang until the device
responds, possibly indefinitely. We wrap the call in a timeout of 1 second, so this function
will not hang indefinitely. If the caller expects the response to take longer (such as during
Fuchsia bootup), it's safe to call the function repeatedly with a longer local timeout.
Makes a call to the TargetCollection ( similar to ` ffx target show ` ) to see if it has a target that matches the specified emulator . If the emulator responds to the request such that a handle is returned it ' s considered " active " . The request documentation indicates that the call to OpenTarget will hang until the device responds possibly indefinitely . We wrap the call in a timeout of 1 second so this function will not hang indefinitely . If the caller expects the response to take longer ( such as during Fuchsia bootup ) it ' s safe to call the function repeatedly with a longer local timeout .
pub async fn is_active(collection_proxy: &bridge::TargetCollectionProxy, name: &str) -> bool {
    let (_proxy, handle) = fidl::endpoints::create_proxy::<bridge::TargetMarker>().unwrap();
    let target = Some(name.to_string());
    let res = timeout(Duration::from_secs(1), async {
        collection_proxy
            .open_target(
                bridge::TargetQuery { string_matcher: target, ..bridge::TargetQuery::EMPTY },
                handle,
            )
            .await
    })
    .await;
    return res.is_ok()                    // It didn't time out...
        && res.as_ref().unwrap().is_ok()  // The call was issued successfully...
        && res.unwrap().unwrap().is_ok(); // And the actual return value was Ok(_).
}
pub async fn is_active ( collection_proxy : & bridge :: TargetCollectionProxy , name : & str ) -> bool { let ( _proxy , handle ) = fidl :: endpoints :: create_proxy :: < bridge :: TargetMarker > ( ) . unwrap ( ) ; let target = Some ( name . to_string ( ) ) ; let res = timeout ( Duration :: from_secs ( 1 ) , async { collection_proxy . open_target ( bridge :: TargetQuery { string_matcher : target , .. bridge :: TargetQuery :: EMPTY } , handle , ) . await } ) . await ; return res . is_ok ( ) // It didn't time out... && res . as_ref ( ) . unwrap ( ) . is_ok ( ) // The call was issued successfully... && res . unwrap ( ) . unwrap ( ) . is_ok ( ) ; // And the actual return value was Ok(_). }
Makes a call to the TargetCollection (similar to `ffx target show`) to see if it has a target
that matches the specified emulator.
Makes a call to the TargetCollection ( similar to ` ffx target show ` ) to see if it has a target that matches the specified emulator .
collection_proxy
&bridge::TargetCollectionProxy
name
&str