#run-time #async #portable #experimental #interoperable #rio #show

nightly rio_rt

A minimal async runtime with an experimental ambition to be an portable and interoperable async runtime for Rust

2 releases

0.1.0-alpha.2 Oct 6, 2022
0.1.0-alpha.1 Oct 5, 2022

#852 in Asynchronous

GPL-2.0 license

9KB
117 lines

Rio Runtime

Code Example

This is a very monkey example just to show how to use Rio API

#![feature(async_fn_in_trait)]
#![feature(associated_type_defaults)]
use log::{debug, info};
use rio_rt::runitime as rio;
use surf;

pub(crate) mod extractor;
mod github;

use extractor::Extractor;

async fn run(extractor: &impl extractor::Extractor<Output = String>) -> Result<(), surf::Error> {
    let content = extractor.search_new().await?;
    info!("{}", content);
    Ok(())
}

fn main() {
    env_logger::init();
    debug!("Here we go, we are all good");
    rio::block_on(async {
        let github = github::GithubExtractor::new();
        run(&github).await.unwrap()
    });
    rio::wait();
}

lib.rs:

Toy library to implement an async library for rust!

This code is hevely based on https://github.com/mgattozzi/whorl but with another scope in mind, that is to provide a toy library that the people can use with toy program.

In addition, from this crate the user can consider to learn more on the async programming, because there is a lot to learn and a lot to contribute.

Dependencies

~87KB