Browse Source

Rename HttpServer::start() to HttpServer::run()

master
Nikolay Kim 2 years ago
parent
commit
6a0cd2dced
  1. 7
      CHANGES.md
  2. 2
      Cargo.toml
  3. 3
      MIGRATION.md
  4. 2
      actix-session/src/lib.rs
  5. 2
      awc/tests/test_client.rs
  6. 2
      awc/tests/test_rustls_client.rs
  7. 2
      awc/tests/test_ssl_client.rs
  8. 2
      examples/basic.rs
  9. 2
      examples/uds.rs
  10. 2
      src/lib.rs
  11. 18
      src/server.rs
  12. 4
      tests/test_httpserver.rs

7
CHANGES.md

@ -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

2
Cargo.toml

@ -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"

3
MIGRATION.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.

2
actix-session/src/lib.rs

@ -37,7 +37,7 @@
//! )
//! .service(web::resource("/").to(|| HttpResponse::Ok())))
//! .bind("127.0.0.1:59880")?
//! .start()
//! .run()
//! .await
//! }
//! ```

2
awc/tests/test_client.rs

@ -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;

2
awc/tests/test_rustls_client.rs

@ -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;

2
awc/tests/test_ssl_client.rs

@ -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;

2
examples/basic.rs

@ -42,6 +42,6 @@ async fn main() -> std::io::Result<()> {
})
.bind("127.0.0.1:8080")?
.workers(1)
.start()
.run()
.await
}

2
examples/uds.rs

@ -45,7 +45,7 @@ async fn main() -> std::io::Result<()> {
})
.bind_uds("/Users/fafhrd91/uds-test")?
.workers(1)
.start()
.run()
.await
}

2
src/lib.rs

@ -20,7 +20,7 @@
//! web::resource("/{name}/{id}/index.html").to(index))
//! )
//! .bind("127.0.0.1:8080")?
//! .start()
//! .run()
//! .await
//! }
//! ```

18
src/server.rs

@ -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()
}
}

4
tests/test_httpserver.rs

@ -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…
Cancel
Save