rogue-runtime 0.1.0

Async RPC Runtime
Documentation
use tracing::debug;

use rogue_runtime::prelude::*;

rpc! {
    pub async fn fib(n: u32) -> u32 {
        debug!(n = %n, "fibonacci start");
        let ret = if n <= 1 {
            n
        } else {
            // Each recursive call is dispatched via RPC
            let a = fib(n - 1).await;
            let b = fib(n - 2).await;
            a + b
        };

        debug!(n = %n, ret = %ret, "fibonacci done");
        ret
    }
}

// placeholder to allow this file to compile as an example
#[allow(dead_code)]
fn main() {}