roa-async-std

Crates.ioroa-async-std
lib.rsroa-async-std
version0.6.0
sourcesrc
created_at2022-01-17 11:12:56.14307
updated_at2022-01-17 11:12:56.14307
descriptiontokio-based runtime and acceptor
homepagehttps://github.com/Hexilee/roa/wiki
repositoryhttps://github.com/Hexilee/roa
max_upload_size
id515497
size15,289
xixi (Hexilee)

documentation

https://docs.rs/roa-tokio

README

Stable Test codecov Rust Docs Crate version Download License: MIT

This crate provides async-std-based runtime and acceptor for roa.

use roa::http::StatusCode;
use roa::{App, Context};
use roa_async_std::{Listener, Exec};
use std::error::Error;

async fn end(_ctx: &mut Context) -> roa::Result {
    Ok(())
}

#[async_std::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let (addr, server) = App::with_exec((), Exec).end(end).run()?;
    println!("server is listening on {}", addr);
    server.await?;
    Ok(())
}
Commit count: 722

cargo fmt