/// Starts a BankAccount provider component in `ACCOUNT_PROVIDERS_COLLECTION`.
Starts a BankAccount provider component in `ACCOUNT_PROVIDERS_COLLECTION`.
Starts a BankAccount provider component in ` ACCOUNT_PROVIDERS_COLLECTION ` .
async fn start_provider(
    realm: &fcomponent::RealmProxy,
    name: &str,
    url: &str,
) -> Result<(), Error> {
    info!("creating BankAccount provider \"{}\" with url={}", name, url);
    let child_args = fcomponent::CreateChildArgs {
        numbered_handles: None,
        ..fcomponent::CreateChildArgs::EMPTY
    };
    realm
        .create_child(
            &mut fdecl::CollectionRef { name: ACCOUNT_PROVIDERS_COLLECTION.to_string() },
            fdecl::Child {
                name: Some(name.to_string()),
                url: Some(url.to_string()),
                startup: Some(fdecl::StartupMode::Lazy),
                environment: None,
                ..fdecl::Child::EMPTY
            },
            child_args,
        )
        .await
        .context("failed to call CreateChild")?
        .map_err(|e| format_err!("Failed to create child: {:?}", e))?;
    let (exposed_dir, exposed_dir_server_end) =
        fidl::endpoints::create_proxy::<fio::DirectoryMarker>()
            .context("failed to create Directory endpoints")?;
    info!("open exposed dir of BankAccount provider \"{}\" with url={}", name, url);
    realm
        .open_exposed_dir(
            &mut fdecl::ChildRef {
                name: name.to_string(),
                collection: Some(ACCOUNT_PROVIDERS_COLLECTION.to_string()),
            },
            exposed_dir_server_end,
        )
        .await
        .context("failed to call OpenExposedDir")?
        .map_err(|e| format_err!("Failed to open exposed dir: {:?}", e))?;
    // Connect to Binder to launch the component.
    let _ = client::connect_to_protocol_at_dir_root::<fcomponent::BinderMarker>(&exposed_dir)
        .context("failed to connect to fuchsia.component.Binder")?;
    Ok(())
}
async fn start_provider ( realm : & fcomponent :: RealmProxy , name : & str , url : & str , ) -> Result < ( ) , Error > { info ! ( " \" \" " name url ) ; let child_args = fcomponent :: CreateChildArgs { numbered_handles : None , .. fcomponent :: CreateChildArgs :: EMPTY } ; realm . create_child ( & mut fdecl :: CollectionRef { name : ACCOUNT_PROVIDERS_COLLECTION . to_string ( ) } , fdecl :: Child { name : Some ( name . to_string ( ) ) , url : Some ( url . to_string ( ) ) , startup : Some ( fdecl :: StartupMode :: Lazy ) , environment : None , .. fdecl :: Child :: EMPTY } , child_args , ) . await . context ( " " ) ? . map_err ( | e | format_err ! ( " " e ) ) ? ; let ( exposed_dir , exposed_dir_server_end ) = fidl :: endpoints :: create_proxy :: < fio :: DirectoryMarker > ( ) . context ( " " ) ? ; info ! ( " \" \" " name url ) ; realm . open_exposed_dir ( & mut fdecl :: ChildRef { name : name . to_string ( ) , collection : Some ( ACCOUNT_PROVIDERS_COLLECTION . to_string ( ) ) , } , exposed_dir_server_end , ) . await . context ( " " ) ? . map_err ( | e | format_err ! ( " " e ) ) ? ; // Connect to Binder to launch the component. let _ = client :: connect_to_protocol_at_dir_root :: < fcomponent :: BinderMarker > ( & exposed_dir ) . context ( " " ) ? ; Ok ( ( ) ) }
Starts a BankAccount provider component in `ACCOUNT_PROVIDERS_COLLECTION`.
Starts a BankAccount provider component in ` ACCOUNT_PROVIDERS_COLLECTION ` .
realm
&fcomponent::RealmProxy
name
&str
url
&str