fauna-api 1.0.773

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

pub mod environment;
pub mod os;
pub mod versioning;

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 Termite 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)
}