mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-30 03:44:27 +02:00
update doc api examples
This commit is contained in:
@ -46,16 +46,16 @@ pub(crate) const MAX_WRITE_BUFFER_SIZE: usize = 65_536;
|
||||
/// use actix_web::{actix, server, App, HttpResponse};
|
||||
///
|
||||
/// fn main() {
|
||||
/// actix::System::run(|| {
|
||||
/// let sys = actix::System::new("example"); // <- create Actix system
|
||||
///
|
||||
/// server::new(
|
||||
/// || App::new()
|
||||
/// .resource("/", |r| r.f(|_| HttpResponse::Ok())))
|
||||
/// .bind("127.0.0.1:59090").unwrap()
|
||||
/// .start();
|
||||
/// server::new(
|
||||
/// || App::new()
|
||||
/// .resource("/", |r| r.f(|_| HttpResponse::Ok())))
|
||||
/// .bind("127.0.0.1:59090").unwrap()
|
||||
/// .start();
|
||||
///
|
||||
/// # actix::System::current().stop();
|
||||
/// });
|
||||
/// sys.run();
|
||||
/// }
|
||||
/// ```
|
||||
pub fn new<F, U, H>(factory: F) -> HttpServer<H>
|
||||
|
@ -402,14 +402,14 @@ impl<H: IntoHttpHandler> HttpServer<H> {
|
||||
/// use actix_web::{actix, server, App, HttpResponse};
|
||||
///
|
||||
/// fn main() {
|
||||
/// // Run actix system, this method actually starts all async processes
|
||||
/// actix::System::run(|| {
|
||||
/// server::new(|| App::new().resource("/", |r| r.h(|_| HttpResponse::Ok())))
|
||||
/// .bind("127.0.0.1:0")
|
||||
/// .expect("Can not bind to 127.0.0.1:0")
|
||||
/// .start();
|
||||
/// # actix::System::current().stop();
|
||||
/// });
|
||||
/// let sys = actix::System::new("example"); // <- create Actix system
|
||||
///
|
||||
/// server::new(|| App::new().resource("/", |r| r.h(|_| HttpResponse::Ok())))
|
||||
/// .bind("127.0.0.1:0")
|
||||
/// .expect("Can not bind to 127.0.0.1:0")
|
||||
/// .start();
|
||||
/// # actix::System::current().stop();
|
||||
/// sys.run(); // <- Run actix system, this method starts all async processes
|
||||
/// }
|
||||
/// ```
|
||||
pub fn start(mut self) -> Addr<Self> {
|
||||
|
Reference in New Issue
Block a user