mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 17:52:56 +01:00
docs: add note about rt::spawn compat with tokio::main
This commit is contained in:
parent
e1c48dba26
commit
043bc88f73
@ -5,6 +5,7 @@
|
|||||||
//! architecture in [`actix-rt`]'s docs.
|
//! architecture in [`actix-rt`]'s docs.
|
||||||
//!
|
//!
|
||||||
//! # Running Actix Web Without Macros
|
//! # Running Actix Web Without Macros
|
||||||
|
//!
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! use actix_web::{middleware, rt, web, App, HttpRequest, HttpServer};
|
//! use actix_web::{middleware, rt, web, App, HttpRequest, HttpServer};
|
||||||
//!
|
//!
|
||||||
@ -25,6 +26,7 @@
|
|||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! # Running Actix Web Using `#[tokio::main]`
|
//! # Running Actix Web Using `#[tokio::main]`
|
||||||
|
//!
|
||||||
//! If you need to run something that uses Tokio's work stealing functionality alongside Actix Web,
|
//! If you need to run something that uses Tokio's work stealing functionality alongside Actix Web,
|
||||||
//! you can run Actix Web under `#[tokio::main]`. The [`Server`](crate::dev::Server) object returned
|
//! you can run Actix Web under `#[tokio::main]`. The [`Server`](crate::dev::Server) object returned
|
||||||
//! from [`HttpServer::run`](crate::HttpServer::run) can also be [`spawn`]ed, if preferred.
|
//! from [`HttpServer::run`](crate::HttpServer::run) can also be [`spawn`]ed, if preferred.
|
||||||
@ -32,6 +34,10 @@
|
|||||||
//! Note that `actix` actor support (and therefore WebSocket support through `actix-web-actors`)
|
//! Note that `actix` actor support (and therefore WebSocket support through `actix-web-actors`)
|
||||||
//! still require `#[actix_web::main]` since they require a [`System`] to be set up.
|
//! still require `#[actix_web::main]` since they require a [`System`] to be set up.
|
||||||
//!
|
//!
|
||||||
|
//! Also note that calls to this module's [`spawn()`] re-export require an `#[actix_web::main]`
|
||||||
|
//! runtime (or a manually configured `LocalSet`) since it makes calls into to the current thread's
|
||||||
|
//! `LocalSet`, which `#[tokio::main]` does not set up.
|
||||||
|
//!
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! use actix_web::{get, middleware, rt, web, App, HttpRequest, HttpServer};
|
//! use actix_web::{get, middleware, rt, web, App, HttpRequest, HttpServer};
|
||||||
//!
|
//!
|
||||||
|
Loading…
Reference in New Issue
Block a user