per_oxo 0.1.1

A highly reactive chat_server
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::actors::chat_service::chat_service_client::ChatServiceClient;
use tonic::transport::Channel;

pub async fn connect_chat_service_client(
    chat_service_addr: String,
) -> Result<ChatServiceClient<Channel>, Box<dyn std::error::Error>> {
    let client = ChatServiceClient::connect(chat_service_addr).await?;
    Ok(client)
}

#[cfg(feature = "mongo_db")]
pub async fn connect_mongo_db_client(
    mongo_db_url: String,
) -> Result<mongodb::Client, Box<dyn std::error::Error>> {
    let options = mongodb::options::ClientOptions::parse(&mongo_db_url).await?;
    let client = mongodb::Client::with_options(options)?;
    Ok(client)
}