mirror of
https://github.com/actix/actix-web.git
synced 2024-11-20 08:31:09 +00:00
cleanup api doc examples
This commit is contained in:
parent
53c5151692
commit
1f0577f8d5
10 changed files with 4 additions and 21 deletions
|
@ -52,7 +52,6 @@ use self::connect::{Connect, ConnectorWrapper};
|
|||
/// An HTTP Client
|
||||
///
|
||||
/// ```rust
|
||||
/// # use futures::future::{Future, lazy};
|
||||
/// use actix_rt::System;
|
||||
/// use awc::Client;
|
||||
///
|
||||
|
|
|
@ -37,7 +37,6 @@ const HTTPS_ENCODING: &str = "gzip, deflate";
|
|||
/// builder-like pattern.
|
||||
///
|
||||
/// ```rust
|
||||
/// use futures::future::{Future, lazy};
|
||||
/// use actix_rt::System;
|
||||
///
|
||||
/// fn main() {
|
||||
|
@ -310,7 +309,6 @@ impl ClientRequest {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use actix_rt::System;
|
||||
/// # use futures::future::{lazy, Future};
|
||||
/// fn main() {
|
||||
/// System::new("test").block_on(async {
|
||||
/// awc::Client::new().get("https://www.rust-lang.org")
|
||||
|
|
|
@ -343,7 +343,6 @@ where
|
|||
///
|
||||
/// ```rust
|
||||
/// use actix_service::Service;
|
||||
/// # use futures::Future;
|
||||
/// use actix_web::{middleware, web, App};
|
||||
/// use actix_web::http::{header::CONTENT_TYPE, HeaderValue};
|
||||
///
|
||||
|
@ -402,7 +401,6 @@ where
|
|||
///
|
||||
/// ```rust
|
||||
/// use actix_service::Service;
|
||||
/// # use futures::Future;
|
||||
/// use actix_web::{web, App};
|
||||
/// use actix_web::http::{header::CONTENT_TYPE, HeaderValue};
|
||||
///
|
||||
|
|
|
@ -171,7 +171,6 @@ pub mod client {
|
|||
//! An HTTP Client
|
||||
//!
|
||||
//! ```rust
|
||||
//! # use futures::future::{Future, lazy};
|
||||
//! use actix_rt::System;
|
||||
//! use actix_web::client::Client;
|
||||
//!
|
||||
|
|
|
@ -244,7 +244,6 @@ where
|
|||
///
|
||||
/// ```rust
|
||||
/// use actix_web::*;
|
||||
/// use futures::future::{ok, Future};
|
||||
///
|
||||
/// async fn index(req: HttpRequest) -> Result<HttpResponse, Error> {
|
||||
/// Ok(HttpResponse::Ok().finish())
|
||||
|
@ -257,7 +256,6 @@ where
|
|||
///
|
||||
/// ```rust
|
||||
/// # use actix_web::*;
|
||||
/// # use futures::future::Future;
|
||||
/// # async fn index(req: HttpRequest) -> Result<HttpResponse, Error> {
|
||||
/// # unimplemented!()
|
||||
/// # }
|
||||
|
@ -326,7 +324,6 @@ where
|
|||
///
|
||||
/// ```rust
|
||||
/// use actix_service::Service;
|
||||
/// # use futures::Future;
|
||||
/// use actix_web::{web, App};
|
||||
/// use actix_web::http::{header::CONTENT_TYPE, HeaderValue};
|
||||
///
|
||||
|
|
|
@ -342,7 +342,6 @@ impl<T: Responder> Future for CustomResponderFut<T> {
|
|||
/// Combines two different responder types into a single type
|
||||
///
|
||||
/// ```rust
|
||||
/// # use futures::future::{ok, Future};
|
||||
/// use actix_web::{Either, Error, HttpResponse};
|
||||
///
|
||||
/// type RegisterResult = Either<HttpResponse, Result<HttpResponse, Error>>;
|
||||
|
|
|
@ -238,9 +238,7 @@ impl Route {
|
|||
/// This method has to be used if your handler function returns `impl Future<>`
|
||||
///
|
||||
/// ```rust
|
||||
/// # use futures::future::ok;
|
||||
/// use actix_web::{web, App, Error};
|
||||
/// use futures::Future;
|
||||
/// use serde_derive::Deserialize;
|
||||
///
|
||||
/// #[derive(Deserialize)]
|
||||
|
|
|
@ -353,7 +353,6 @@ where
|
|||
///
|
||||
/// ```rust
|
||||
/// use actix_service::Service;
|
||||
/// # use futures::Future;
|
||||
/// use actix_web::{web, App};
|
||||
/// use actix_web::http::{header::CONTENT_TYPE, HeaderValue};
|
||||
///
|
||||
|
|
|
@ -449,11 +449,10 @@ impl WebService {
|
|||
/// Add match guard to a web service.
|
||||
///
|
||||
/// ```rust
|
||||
/// use futures::future::{ok, Ready};
|
||||
/// use actix_web::{web, guard, dev, App, Error, HttpResponse};
|
||||
///
|
||||
/// fn index(req: dev::ServiceRequest) -> Ready<Result<dev::ServiceResponse, Error>> {
|
||||
/// ok(req.into_response(HttpResponse::Ok().finish()))
|
||||
/// async fn index(req: dev::ServiceRequest) -> Result<dev::ServiceResponse, Error> {
|
||||
/// Ok(req.into_response(HttpResponse::Ok().finish()))
|
||||
/// }
|
||||
///
|
||||
/// fn main() {
|
||||
|
|
|
@ -254,7 +254,6 @@ where
|
|||
/// Create a new route and add async handler.
|
||||
///
|
||||
/// ```rust
|
||||
/// # use futures::future::{ok, Future};
|
||||
/// use actix_web::{web, App, HttpResponse, Error};
|
||||
///
|
||||
/// async fn index() -> Result<HttpResponse, Error> {
|
||||
|
@ -278,12 +277,10 @@ where
|
|||
/// Create raw service for a specific path.
|
||||
///
|
||||
/// ```rust
|
||||
/// # extern crate actix_web;
|
||||
/// use futures::future::{ok, Ready};
|
||||
/// use actix_web::{dev, web, guard, App, Error, HttpResponse};
|
||||
///
|
||||
/// fn my_service(req: dev::ServiceRequest) -> Ready<Result<dev::ServiceResponse, Error>> {
|
||||
/// ok(req.into_response(HttpResponse::Ok().finish()))
|
||||
/// async fn my_service(req: dev::ServiceRequest) -> Result<dev::ServiceResponse, Error> {
|
||||
/// Ok(req.into_response(HttpResponse::Ok().finish()))
|
||||
/// }
|
||||
///
|
||||
/// fn main() {
|
||||
|
|
Loading…
Reference in a new issue