summaryrefslogtreecommitdiff
path: root/src/client.rs
blob: 750fe1a4ec30b77819cfc8f35549b735e93953b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use clawflake::clawflake_client::ClawflakeClient;
use clawflake::IdRequest;

pub mod clawflake {
    tonic::include_proto!("clawflake");
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let addr = "http://[::1]:50051";

    let mut client = ClawflakeClient::connect(addr).await?;

    println!("Client connected to {}", addr);
    let request = tonic::Request::new(IdRequest {});

    println!("Trying to get an ID");
    let response = client.get_id(request).await?;

    println!("Received: {:?}", response);

    Ok(())
}