mirror of https://github.com/fafhrd91/actix-net
reverse out-of-scope change
This commit is contained in:
parent
20c66f89ad
commit
6a1d254931
|
@ -10,20 +10,14 @@ async fn handle(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
#[cfg(not(feature = "io-uring"))]
|
actix_rt::System::with_tokio_rt(|| {
|
||||||
let rt = actix_rt::System::with_tokio_rt(|| {
|
|
||||||
tokio::runtime::Builder::new_multi_thread()
|
tokio::runtime::Builder::new_multi_thread()
|
||||||
.enable_all()
|
.enable_all()
|
||||||
.build()
|
.build()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
});
|
// for io_uring feature use `tokio_uring::Runtime::new(&tokio_uring::builder()).unwrap()`
|
||||||
#[cfg(feature = "io-uring")]
|
})
|
||||||
let rt = actix_rt::System::with_tokio_rt(|| {
|
.block_on(async {
|
||||||
tokio_uring::Runtime::new(&tokio_uring::builder())
|
|
||||||
.unwrap()
|
|
||||||
});
|
|
||||||
|
|
||||||
rt.block_on(async {
|
|
||||||
let make_service =
|
let make_service =
|
||||||
make_service_fn(|_conn| async { Ok::<_, Infallible>(service_fn(handle)) });
|
make_service_fn(|_conn| async { Ok::<_, Infallible>(service_fn(handle)) });
|
||||||
|
|
||||||
|
|
|
@ -4,22 +4,15 @@
|
||||||
use actix_rt::System;
|
use actix_rt::System;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
#[cfg(not(feature = "io-uring"))]
|
System::with_tokio_rt(|| {
|
||||||
let system = System::with_tokio_rt(|| {
|
|
||||||
// build system with a multi-thread tokio runtime.
|
// build system with a multi-thread tokio runtime.
|
||||||
tokio::runtime::Builder::new_multi_thread()
|
tokio::runtime::Builder::new_multi_thread()
|
||||||
.worker_threads(2)
|
.worker_threads(2)
|
||||||
.enable_all()
|
.enable_all()
|
||||||
.build()
|
.build()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
});
|
})
|
||||||
#[cfg(feature = "io-uring")]
|
.block_on(async_main());
|
||||||
let system = System::with_tokio_rt(|| {
|
|
||||||
// build system with tokio uring runtime.
|
|
||||||
tokio_uring::Runtime::new(&tokio_uring::builder())
|
|
||||||
.unwrap()
|
|
||||||
});
|
|
||||||
system.block_on(async_main());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// async main function that acts like #[actix_web::main] or #[tokio::main]
|
// async main function that acts like #[actix_web::main] or #[tokio::main]
|
||||||
|
|
Loading…
Reference in New Issue