pub async fn connect_client<A, S>(
    ilp_address: Address,
    accounts: Vec<A>,
    error_on_unavailable: bool,
    next_outgoing: S,
) -> Result<BtpOutgoingService<S, A>, BtpClientError>
where
    S: OutgoingService<A> + Clone + 'static,
    A: BtpAccount + Send + Sync + 'static,
{
    let service = BtpOutgoingService::new(ilp_address, next_outgoing);
    let mut connect_btp = Vec::new();
    for account in accounts {
        // Can we make this take a reference to a service?
        connect_btp.push(connect_to_service_account(
            account,
            error_on_unavailable,
            service.clone(),
        ));
    }
    let res = join_all(connect_btp).await;
    if res.into_iter().any(|r| r.is_err()) {
        return Err(BtpClientError::CannotConnectMultiple);
    }
    Ok(service)
}
/// Create a BtpOutgoingService wrapping BTP connections to the accounts specified.
/// Calling `handle_incoming` with an `IncomingService` will turn the returned
/// BtpOutgoingService into a bidirectional handler.
Create a BtpOutgoingService wrapping BTP connections to the accounts specified.
Calling `handle_incoming` with an `IncomingService` will turn the returned
BtpOutgoingService into a bidirectional handler.
Create a BtpOutgoingService wrapping BTP connections to the accounts specified . Calling ` handle_incoming ` with an ` IncomingService ` will turn the returned BtpOutgoingService into a bidirectional handler .
pub async fn connect_client<A, S>(
    ilp_address: Address,
    accounts: Vec<A>,
    error_on_unavailable: bool,
    next_outgoing: S,
) -> Result<BtpOutgoingService<S, A>, BtpClientError>
where
    S: OutgoingService<A> + Clone + 'static,
    A: BtpAccount + Send + Sync + 'static,
{
    let service = BtpOutgoingService::new(ilp_address, next_outgoing);
    let mut connect_btp = Vec::new();
    for account in accounts {
        // Can we make this take a reference to a service?
        connect_btp.push(connect_to_service_account(
            account,
            error_on_unavailable,
            service.clone(),
        ));
    }
    let res = join_all(connect_btp).await;
    if res.into_iter().any(|r| r.is_err()) {
        return Err(BtpClientError::CannotConnectMultiple);
    }
    Ok(service)
}
pub async fn connect_client < A , S > ( ilp_address : Address , accounts : Vec < A > , error_on_unavailable : bool , next_outgoing : S , ) -> Result < BtpOutgoingService < S , A > , BtpClientError > where S : OutgoingService < A > + Clone + ' static , A : BtpAccount + Send + Sync + ' static , { let service = BtpOutgoingService :: new ( ilp_address , next_outgoing ) ; let mut connect_btp = Vec :: new ( ) ; for account in accounts { // Can we make this take a reference to a service? connect_btp . push ( connect_to_service_account ( account , error_on_unavailable , service . clone ( ) , ) ) ; } let res = join_all ( connect_btp ) . await ; if res . into_iter ( ) . any ( | r | r . is_err ( ) ) { return Err ( BtpClientError :: CannotConnectMultiple ) ; } Ok ( service ) }
Create a BtpOutgoingService wrapping BTP connections to the accounts specified.
Create a BtpOutgoingService wrapping BTP connections to the accounts specified .
ilp_address
Address
accounts
Vec<A>
error_on_unavailable
bool
next_outgoing
S
ilp_address
Address
accounts
Vec<A>
error_on_unavailable
bool
next_outgoing
S