fauna-api 1.0.816

The Fauna SDK for Rust: accounts, Drive, groups, calendar, chats, payments, Parrot and live rooms.
Documentation
//! `Ant` in `api/node/src/ant/index.ts`.

pub mod chat;
pub mod format;
pub mod graph;
pub mod persona;
pub mod timeline;

use std::time::Instant;

use crate::error::Result;
use crate::http;

static ROUTE: crate::route::Cell = crate::route::cell();

pub fn set_route(route: &str) {
    crate::route::set(&ROUTE, route);
}

pub fn get_ip() -> String {
    crate::route::ip(&ROUTE)
}

pub fn get_port() -> u16 {
    crate::route::port(&ROUTE)
}

pub fn get_route() -> String {
    crate::route::route(&ROUTE)
}

pub fn get_url() -> String {
    crate::route::url(&ROUTE)
}

/// Milliseconds for one round trip to the Ant root.
pub async fn ping() -> Result<u64> {
    let start = Instant::now();
    http::client().get(format!("{}/", get_url())).send().await?;
    Ok(start.elapsed().as_millis() as u64)
}