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