segment-rs 0.0.1-alpha.9

Official Rust client for the Segment server
Documentation
use crate::connection::{Connection, ConnectionError, ConnectionOptions};

#[derive(Debug)]
/// Segment client
pub struct Client {
    options: ConnectionOptions,
}

impl Client {
    /// Creates a new client, this does not create a new connection
    pub fn new(options: ConnectionOptions) -> Self {
        Client { options }
    }

    /// Creates a new connection
    pub async fn get_connection(&self) -> Result<Connection, ConnectionError> {
        Connection::connect(&self.options).await
    }
}