Skip to content

Commit

Permalink
Rename HttpServer::start() to HttpServer::run()
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Dec 22, 2019
1 parent c7f3915 commit 6a0cd2d
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 21 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "actix-web"
version = "2.0.0-rc"
version = "2.0.0"
authors = ["Nikolay Kim <[email protected]>"]
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
readme = "README.md"
Expand Down
3 changes: 3 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion actix-session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
//! )
//! .service(web::resource("/").to(|| HttpResponse::Ok())))
//! .bind("127.0.0.1:59880")?
//! .start()
//! .run()
//! .await
//! }
//! ```
Expand Down
2 changes: 1 addition & 1 deletion awc/tests/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion awc/tests/test_rustls_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion awc/tests/test_ssl_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ async fn main() -> std::io::Result<()> {
})
.bind("127.0.0.1:8080")?
.workers(1)
.start()
.run()
.await
}
2 changes: 1 addition & 1 deletion examples/uds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async fn main() -> std::io::Result<()> {
})
.bind_uds("/Users/fafhrd91/uds-test")?
.workers(1)
.start()
.run()
.await
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! web::resource("/{name}/{id}/index.html").to(index))
//! )
//! .bind("127.0.0.1:8080")?
//! .start()
//! .run()
//! .await
//! }
//! ```
Expand Down
18 changes: 7 additions & 11 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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()
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_httpserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 6a0cd2d

Please sign in to comment.