1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-24 00:21:08 +01:00

remove old api doc refs

This commit is contained in:
Nikolay Kim 2019-04-29 18:42:21 -07:00
parent f4e1205cbb
commit 94a0d1a6bc

View File

@ -59,9 +59,9 @@ impl Drop for Inner {
/// This function panics on nested call. /// This function panics on nested call.
pub fn block_on<F>(f: F) -> Result<F::Item, F::Error> pub fn block_on<F>(f: F) -> Result<F::Item, F::Error>
where where
F: Future, F: IntoFuture,
{ {
RT.with(move |rt| rt.borrow_mut().get_mut().block_on(f)) RT.with(move |rt| rt.borrow_mut().get_mut().block_on(f.into_future()))
} }
/// Runs the provided function, blocking the current thread until the resul /// Runs the provided function, blocking the current thread until the resul
@ -330,12 +330,11 @@ where
/// For unit testing, actix provides a request builder type and a simple handler runner. TestRequest implements a builder-like pattern. /// For unit testing, actix provides a request builder type and a simple handler runner. TestRequest implements a builder-like pattern.
/// You can generate various types of request via TestRequest's methods: /// You can generate various types of request via TestRequest's methods:
/// * `TestRequest::to_request` creates `actix_http::Request` instance. /// * `TestRequest::to_request` creates `actix_http::Request` instance.
/// * `TestRequest::to_service` creates `ServiceRequest` instance, which is used for testing middlewares and chain adapters. /// * `TestRequest::to_srv_request` creates `ServiceRequest` instance, which is used for testing middlewares and chain adapters.
/// * `TestRequest::to_from` creates `ServiceFromRequest` instance, which is used for testing extractors. /// * `TestRequest::to_srv_response` creates `ServiceResponse` instance.
/// * `TestRequest::to_http_request` creates `HttpRequest` instance, which is used for testing handlers. /// * `TestRequest::to_http_request` creates `HttpRequest` instance, which is used for testing handlers.
/// ///
/// ```rust /// ```rust
/// # use futures::IntoFuture;
/// use actix_web::{test, HttpRequest, HttpResponse, HttpMessage}; /// use actix_web::{test, HttpRequest, HttpResponse, HttpMessage};
/// use actix_web::http::{header, StatusCode}; /// use actix_web::http::{header, StatusCode};
/// ///
@ -352,11 +351,11 @@ where
/// let req = test::TestRequest::with_header("content-type", "text/plain") /// let req = test::TestRequest::with_header("content-type", "text/plain")
/// .to_http_request(); /// .to_http_request();
/// ///
/// let resp = test::block_on(index(req).into_future()).unwrap(); /// let resp = test::block_on(index(req)).unwrap();
/// assert_eq!(resp.status(), StatusCode::OK); /// assert_eq!(resp.status(), StatusCode::OK);
/// ///
/// let req = test::TestRequest::default().to_http_request(); /// let req = test::TestRequest::default().to_http_request();
/// let resp = test::block_on(index(req).into_future()).unwrap(); /// let resp = test::block_on(index(req)).unwrap();
/// assert_eq!(resp.status(), StatusCode::BAD_REQUEST); /// assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
/// } /// }
/// ``` /// ```