/// Create and connect a FIDL proxy to the service at `path`. Calls `wait_for_path` to ensure the
/// path exists before attempting a connection.
Create and connect a FIDL proxy to the service at `path`. Calls `wait_for_path` to ensure the
path exists before attempting a connection.
Create and connect a FIDL proxy to the service at ` path ` . Calls ` wait_for_path ` to ensure the path exists before attempting a connection .
pub fn connect_proxy<T: fidl::endpoints::ServiceMarker>(
    path: &String,
) -> Result<T::Proxy, anyhow::Error> {
    let (proxy, server) = fidl::endpoints::create_proxy::<T>()
        .map_err(|e| anyhow::format_err!("Failed to create proxy: {}", e))?;
    // Verify the path exists before attempting to connect to it. We do this because when connecting
    // to drivers, a connection to a missing driver path would succeed but calls to it would fail.
    // So instead of requiring us to implement logic at a higher layer to poll repeatedly until a
    // driver is present, just verify the path exists here using the appropriate watcher APIs.
    wait_for_path(&std::path::Path::new(path))?;
    fdio::service_connect(path, server.into_channel())
        .map_err(|s| anyhow::format_err!("Failed to connect to service at {}: {}", path, s))?;
    Ok(proxy)
}
pub fn connect_proxy < T : fidl :: endpoints :: ServiceMarker > ( path : & String , ) -> Result < T :: Proxy , anyhow :: Error > { let ( proxy , server ) = fidl :: endpoints :: create_proxy :: < T > ( ) . map_err ( | e | anyhow :: format_err ! ( " " e ) ) ? ; // Verify the path exists before attempting to connect to it. We do this because when connecting // to drivers, a connection to a missing driver path would succeed but calls to it would fail. // So instead of requiring us to implement logic at a higher layer to poll repeatedly until a // driver is present, just verify the path exists here using the appropriate watcher APIs. wait_for_path ( & std :: path :: Path :: new ( path ) ) ? ; fdio :: service_connect ( path , server . into_channel ( ) ) . map_err ( | s | anyhow :: format_err ! ( " " path s ) ) ? ; Ok ( proxy ) }
Create and connect a FIDL proxy to the service at `path`.
Create and connect a FIDL proxy to the service at ` path ` .
path
&String