fauna-api 1.0.676

The Fauna SDK for Rust: accounts, Drive, groups, calendar, chats, payments, Parrot and live rooms.
Documentation
//! `Parrot` in `api/node/src/parrot/index.ts`. Only the chat HTTP calls are
//! ported so far; the generative, routing, format, agent, share and room
//! modules are pending.

pub mod chat;

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