Browse Source

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

master
Nikolay Kim 10 months ago
parent
commit
6a0cd2dced
12 changed files with 27 additions and 21 deletions
  1. +7
    -0
      CHANGES.md
  2. +1
    -1
      Cargo.toml
  3. +3
    -0
      MIGRATION.md
  4. +1
    -1
      actix-session/src/lib.rs
  5. +1
    -1
      awc/tests/test_client.rs
  6. +1
    -1
      awc/tests/test_rustls_client.rs
  7. +1
    -1
      awc/tests/test_ssl_client.rs
  8. +1
    -1
      examples/basic.rs
  9. +1
    -1
      examples/uds.rs
  10. +1
    -1
      src/lib.rs
  11. +7
    -11
      src/server.rs
  12. +2
    -2
      tests/test_httpserver.rs

+ 7
- 0
CHANGES.md View File

@@ -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
- 1
Cargo.toml View File

@@ -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
- 0
MIGRATION.md View File

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



+ 1
- 1
actix-session/src/lib.rs View File

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


+ 1
- 1
awc/tests/test_client.rs View File

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


+ 1
- 1
awc/tests/test_rustls_client.rs View File

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


+ 1
- 1
awc/tests/test_ssl_client.rs View File

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


+ 1
- 1
examples/basic.rs View File

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

+ 1
- 1
examples/uds.rs View File

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



+ 1
- 1
src/lib.rs View File

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


+ 7
- 11
src/server.rs View File

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


+ 2
- 2
tests/test_httpserver.rs View File

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