mirror of
https://github.com/actix/actix-web.git
synced 2024-06-02 13:29:24 +00:00
40a4b1ccd5
Co-authored-by: Ibraheem Ahmed <ibrah1440@gmail.com>
39 lines
1.1 KiB
Rust
39 lines
1.1 KiB
Rust
//! A selection of re-exports from [`actix-rt`] and [`tokio`].
|
|
//!
|
|
//! [`actix-rt`]: https://docs.rs/actix_rt
|
|
//! [`tokio`]: https://docs.rs/tokio
|
|
//!
|
|
//! # Running Actix Web Macro-less
|
|
//! ```no_run
|
|
//! use actix_web::{middleware, rt, web, App, HttpRequest, HttpServer};
|
|
//!
|
|
//! async fn index(req: HttpRequest) -> &'static str {
|
|
//! println!("REQ: {:?}", req);
|
|
//! "Hello world!\r\n"
|
|
//! }
|
|
//!
|
|
//! # fn main() -> std::io::Result<()> {
|
|
//! rt::System::new().block_on(
|
|
//! HttpServer::new(|| {
|
|
//! App::new()
|
|
//! .wrap(middleware::Logger::default())
|
|
//! .service(web::resource("/").route(web::get().to(index)))
|
|
//! })
|
|
//! .bind(("127.0.0.1", 8080))?
|
|
//! .workers(1)
|
|
//! .run()
|
|
//! )
|
|
//! # }
|
|
//! ```
|
|
|
|
// In particular:
|
|
// - Omit the `Arbiter` types because they have limited value here.
|
|
// - Re-export but hide the runtime macros because they won't work directly but are required for
|
|
// `#[actix_web::main]` and `#[actix_web::test]` to work.
|
|
|
|
pub use actix_rt::{net, pin, signal, spawn, task, time, Runtime, System, SystemRunner};
|
|
|
|
#[cfg(feature = "macros")]
|
|
#[doc(hidden)]
|
|
pub use actix_rt::{main, test};
|