use {
amiya::{m, Executor},
tokio::runtime::Runtime,
};
struct TokioExecutor(Runtime);
impl Executor for TokioExecutor {
fn spawn<T: Send + 'static>(
&self, future: impl futures_lite::Future<Output = T> + Send + 'static,
) {
self.0.spawn(future);
}
fn block_on<T>(&self, future: impl std::future::Future<Output = T>) -> T {
self.0.block_on(future)
}
}
fn main() {
#[rustfmt::skip]
let app = amiya::new()
.uses(m!(ctx =>
ctx.resp.set_body(format!("Hello World from: {}", ctx.path()));
));
app.listen("[::]:8080").unwrap();
std::thread::park();
}