A client can also be initialized with custom endpoint configuration.
use dgraph_tonic::{Endpoint, EndpointConfig, Client};
use std::time::Duration;
#[derive(Debug, Default)]
struct EndpointWithTimeout {}
impl EndpointConfig for EndpointWithTimeout {
fn configure_endpoint(&self, endpoint: Endpoint) -> Endpoint {
endpoint.timeout(Duration::from_secs(5))
}
}
fn main() {
let endpoint_config = EndpointWithTimeout::default();
let client = Client::new_with_endpoint_config("http://127.0.0.1:19080",endpoint_config).expect("Dgraph client");
}