fauna-api 1.0.811

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

pub mod browser;
pub mod media;
pub mod research;
pub mod scraper;
pub mod web;
pub mod workspace;

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