rogue-runtime 0.1.0

Async RPC Runtime
Documentation
mod common;

use anyhow::Result;
use tracing::info;

use rogue_runtime::prelude::*;

use crate::common::fib;

#[tokio::main]
async fn main() -> Result<()> {
    tracing_subscriber::fmt()
        .with_env_filter("client=info")
        .pretty()
        .init();

    info!("starting client example");

    let runtime = Runtime::create("client".to_string()).await?;

    info!("connecting to server at ws://localhost:8080");
    runtime.connect("ws://localhost:8080".to_string()).await?;

    info!("connected to server");

    runtime
        .execute("agent".to_string(), async move {
            for n in 0..10 {
                let ret = fib(n).await;
                info!(n = %n, ret = %ret, "fibonacci");
            }
            Ok(())
        })
        .await?;

    info!("client finished operations");

    Ok(())
}