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