mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 00:21:08 +01:00
Rename HttpServer::start() to HttpServer::run()
This commit is contained in:
parent
c7f3915779
commit
6a0cd2dced
@ -1,5 +1,12 @@
|
||||
# Changes
|
||||
|
||||
## [2.0.0] - 2019-12-xx
|
||||
|
||||
### Changed
|
||||
|
||||
* Rename `HttpServer::start()` to `HttpServer::run()`
|
||||
|
||||
|
||||
## [2.0.0-rc] - 2019-12-20
|
||||
|
||||
### Changed
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "actix-web"
|
||||
version = "2.0.0-rc"
|
||||
version = "2.0.0"
|
||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
|
||||
readme = "README.md"
|
||||
|
@ -1,5 +1,8 @@
|
||||
## 2.0.0
|
||||
|
||||
* `HttpServer::start()` renamed to `HttpServer::run()`. It also possible to
|
||||
`.await` on `run` method result, in that case it awaits server exit.
|
||||
|
||||
* `App::register_data()` renamed to `App::app_data()` and accepts any type `T: 'static`.
|
||||
Stored data is available via `HttpRequest::app_data()` method at runtime.
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
//! )
|
||||
//! .service(web::resource("/").to(|| HttpResponse::Ok())))
|
||||
//! .bind("127.0.0.1:59880")?
|
||||
//! .start()
|
||||
//! .run()
|
||||
//! .await
|
||||
//! }
|
||||
//! ```
|
||||
|
@ -14,7 +14,7 @@ use rand::Rng;
|
||||
|
||||
use actix_http::HttpService;
|
||||
use actix_http_test::test_server;
|
||||
use actix_service::{map_config, pipeline_factory, IntoServiceFactory};
|
||||
use actix_service::{map_config, pipeline_factory};
|
||||
use actix_web::dev::{AppConfig, BodyEncoding};
|
||||
use actix_web::http::Cookie;
|
||||
use actix_web::middleware::Compress;
|
||||
|
@ -4,7 +4,7 @@ use std::sync::Arc;
|
||||
|
||||
use actix_http::HttpService;
|
||||
use actix_http_test::test_server;
|
||||
use actix_service::{map_config, pipeline_factory, IntoServiceFactory, ServiceFactory};
|
||||
use actix_service::{map_config, pipeline_factory, ServiceFactory};
|
||||
use actix_web::http::Version;
|
||||
use actix_web::{dev::AppConfig, web, App, HttpResponse};
|
||||
use futures::future::ok;
|
||||
|
@ -4,7 +4,7 @@ use std::sync::Arc;
|
||||
|
||||
use actix_http::HttpService;
|
||||
use actix_http_test::test_server;
|
||||
use actix_service::{map_config, pipeline_factory, IntoServiceFactory, ServiceFactory};
|
||||
use actix_service::{map_config, pipeline_factory, ServiceFactory};
|
||||
use actix_web::http::Version;
|
||||
use actix_web::{dev::AppConfig, web, App, HttpResponse};
|
||||
use futures::future::ok;
|
||||
|
@ -42,6 +42,6 @@ async fn main() -> std::io::Result<()> {
|
||||
})
|
||||
.bind("127.0.0.1:8080")?
|
||||
.workers(1)
|
||||
.start()
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ async fn main() -> std::io::Result<()> {
|
||||
})
|
||||
.bind_uds("/Users/fafhrd91/uds-test")?
|
||||
.workers(1)
|
||||
.start()
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
//! web::resource("/{name}/{id}/index.html").to(index))
|
||||
//! )
|
||||
//! .bind("127.0.0.1:8080")?
|
||||
//! .start()
|
||||
//! .run()
|
||||
//! .await
|
||||
//! }
|
||||
//! ```
|
||||
|
@ -38,21 +38,17 @@ struct Config {
|
||||
///
|
||||
/// Create new http server with application factory.
|
||||
///
|
||||
/// ```rust
|
||||
/// use std::io;
|
||||
/// ```rust,no_run
|
||||
/// use actix_web::{web, App, HttpResponse, HttpServer};
|
||||
///
|
||||
/// fn main() -> io::Result<()> {
|
||||
/// let sys = actix_rt::System::new("example"); // <- create Actix runtime
|
||||
///
|
||||
/// #[actix_rt::main]
|
||||
/// async fn main() -> std::io::Result<()> {
|
||||
/// HttpServer::new(
|
||||
/// || App::new()
|
||||
/// .service(web::resource("/").to(|| HttpResponse::Ok())))
|
||||
/// .bind("127.0.0.1:59090")?
|
||||
/// .start();
|
||||
///
|
||||
/// # actix_rt::System::current().stop();
|
||||
/// sys.run()
|
||||
/// .run()
|
||||
/// .await
|
||||
/// }
|
||||
/// ```
|
||||
pub struct HttpServer<F, I, S, B>
|
||||
@ -557,11 +553,11 @@ where
|
||||
/// async fn main() -> io::Result<()> {
|
||||
/// HttpServer::new(|| App::new().service(web::resource("/").to(|| HttpResponse::Ok())))
|
||||
/// .bind("127.0.0.1:0")?
|
||||
/// .start()
|
||||
/// .run()
|
||||
/// .await
|
||||
/// }
|
||||
/// ```
|
||||
pub fn start(self) -> Server {
|
||||
pub fn run(self) -> Server {
|
||||
self.builder.start()
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ async fn test_start() {
|
||||
.disable_signals()
|
||||
.bind(format!("{}", addr))
|
||||
.unwrap()
|
||||
.start();
|
||||
.run();
|
||||
|
||||
let _ = tx.send((srv, actix_rt::System::current()));
|
||||
let _ = sys.run();
|
||||
@ -111,7 +111,7 @@ async fn test_start_ssl() {
|
||||
.disable_signals()
|
||||
.bind_openssl(format!("{}", addr), builder)
|
||||
.unwrap()
|
||||
.start();
|
||||
.run();
|
||||
|
||||
let _ = tx.send((srv, actix_rt::System::current()));
|
||||
let _ = sys.run();
|
||||
|
Loading…
Reference in New Issue
Block a user