1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-22 08:07:18 +00:00

Convert documentation examples to Rust 2018 edition (#1120)

* Convert types::query examples to rust-2018 edition

* Convert types::json examples to rust-2018 edition

* Convert types::path examples to rust-2018 edition

* Convert types::form examples to rust-2018 edition

* Convert rest of the examples to rust-2018 edition.
This commit is contained in:
Priit Laes 2019-10-07 08:29:11 +03:00 committed by Nikolay Kim
parent f089cf185b
commit 0f09415469
7 changed files with 23 additions and 25 deletions

View file

@ -46,9 +46,9 @@ pub trait FromRequest: Sized {
/// ## Example /// ## Example
/// ///
/// ```rust /// ```rust
/// # #[macro_use] extern crate serde_derive;
/// use actix_web::{web, dev, App, Error, HttpRequest, FromRequest}; /// use actix_web::{web, dev, App, Error, HttpRequest, FromRequest};
/// use actix_web::error::ErrorBadRequest; /// use actix_web::error::ErrorBadRequest;
/// use serde_derive::Deserialize;
/// use rand; /// use rand;
/// ///
/// #[derive(Debug, Deserialize)] /// #[derive(Debug, Deserialize)]
@ -119,9 +119,9 @@ where
/// ## Example /// ## Example
/// ///
/// ```rust /// ```rust
/// # #[macro_use] extern crate serde_derive;
/// use actix_web::{web, dev, App, Result, Error, HttpRequest, FromRequest}; /// use actix_web::{web, dev, App, Result, Error, HttpRequest, FromRequest};
/// use actix_web::error::ErrorBadRequest; /// use actix_web::error::ErrorBadRequest;
/// use serde_derive::Deserialize;
/// use rand; /// use rand;
/// ///
/// #[derive(Debug, Deserialize)] /// #[derive(Debug, Deserialize)]

View file

@ -271,8 +271,8 @@ impl Drop for HttpRequest {
/// ## Example /// ## Example
/// ///
/// ```rust /// ```rust
/// # #[macro_use] extern crate serde_derive;
/// use actix_web::{web, App, HttpRequest}; /// use actix_web::{web, App, HttpRequest};
/// use serde_derive::Deserialize;
/// ///
/// /// extract `Thing` from request /// /// extract `Thing` from request
/// fn index(req: HttpRequest) -> String { /// fn index(req: HttpRequest) -> String {

View file

@ -178,8 +178,8 @@ impl Route {
/// Set handler function, use request extractors for parameters. /// Set handler function, use request extractors for parameters.
/// ///
/// ```rust /// ```rust
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{web, http, App}; /// use actix_web::{web, http, App};
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Deserialize)] /// #[derive(Deserialize)]
/// struct Info { /// struct Info {
@ -239,9 +239,9 @@ impl Route {
/// ///
/// ```rust /// ```rust
/// # use futures::future::ok; /// # use futures::future::ok;
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{web, App, Error}; /// use actix_web::{web, App, Error};
/// use futures::Future; /// use futures::Future;
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Deserialize)] /// #[derive(Deserialize)]
/// struct Info { /// struct Info {

View file

@ -35,9 +35,8 @@ use crate::responder::Responder;
/// ///
/// ### Example /// ### Example
/// ```rust /// ```rust
/// # extern crate actix_web; /// use actix_web::web;
/// #[macro_use] extern crate serde_derive; /// use serde_derive::Deserialize;
/// use actix_web::{web, App};
/// ///
/// #[derive(Deserialize)] /// #[derive(Deserialize)]
/// struct FormData { /// struct FormData {
@ -61,9 +60,9 @@ use crate::responder::Responder;
/// ///
/// ### Example /// ### Example
/// ```rust /// ```rust
/// # #[macro_use] extern crate serde_derive; /// use actix_web::*;
/// # use actix_web::*; /// use serde_derive::Serialize;
/// # ///
/// #[derive(Serialize)] /// #[derive(Serialize)]
/// struct SomeForm { /// struct SomeForm {
/// name: String, /// name: String,
@ -167,8 +166,8 @@ impl<T: Serialize> Responder for Form<T> {
/// Form extractor configuration /// Form extractor configuration
/// ///
/// ```rust /// ```rust
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{web, App, FromRequest, Result}; /// use actix_web::{web, App, FromRequest, Result};
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Deserialize)] /// #[derive(Deserialize)]
/// struct FormData { /// struct FormData {

View file

@ -33,8 +33,8 @@ use crate::responder::Responder;
/// ## Example /// ## Example
/// ///
/// ```rust /// ```rust
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{web, App}; /// use actix_web::{web, App};
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Deserialize)] /// #[derive(Deserialize)]
/// struct Info { /// struct Info {
@ -60,9 +60,9 @@ use crate::responder::Responder;
/// trait from *serde*. /// trait from *serde*.
/// ///
/// ```rust /// ```rust
/// # #[macro_use] extern crate serde_derive; /// use actix_web::*;
/// # use actix_web::*; /// use serde_derive::Serialize;
/// # ///
/// #[derive(Serialize)] /// #[derive(Serialize)]
/// struct MyObj { /// struct MyObj {
/// name: String, /// name: String,
@ -144,8 +144,8 @@ impl<T: Serialize> Responder for Json<T> {
/// ## Example /// ## Example
/// ///
/// ```rust /// ```rust
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{web, App}; /// use actix_web::{web, App};
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Deserialize)] /// #[derive(Deserialize)]
/// struct Info { /// struct Info {
@ -203,8 +203,8 @@ where
/// Json extractor configuration /// Json extractor configuration
/// ///
/// ```rust /// ```rust
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{error, web, App, FromRequest, HttpResponse}; /// use actix_web::{error, web, App, FromRequest, HttpResponse};
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Deserialize)] /// #[derive(Deserialize)]
/// struct Info { /// struct Info {

View file

@ -39,8 +39,8 @@ use crate::FromRequest;
/// implements `Deserialize` trait from *serde*. /// implements `Deserialize` trait from *serde*.
/// ///
/// ```rust /// ```rust
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{web, App, Error}; /// use actix_web::{web, App, Error};
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Deserialize)] /// #[derive(Deserialize)]
/// struct Info { /// struct Info {
@ -134,8 +134,8 @@ impl<T: fmt::Display> fmt::Display for Path<T> {
/// implements `Deserialize` trait from *serde*. /// implements `Deserialize` trait from *serde*.
/// ///
/// ```rust /// ```rust
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{web, App, Error}; /// use actix_web::{web, App, Error};
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Deserialize)] /// #[derive(Deserialize)]
/// struct Info { /// struct Info {
@ -190,10 +190,9 @@ where
/// Path extractor configuration /// Path extractor configuration
/// ///
/// ```rust /// ```rust
/// # #[macro_use]
/// # extern crate serde_derive;
/// use actix_web::web::PathConfig; /// use actix_web::web::PathConfig;
/// use actix_web::{error, web, App, FromRequest, HttpResponse}; /// use actix_web::{error, web, App, FromRequest, HttpResponse};
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Deserialize, Debug)] /// #[derive(Deserialize, Debug)]
/// enum Folder { /// enum Folder {

View file

@ -21,8 +21,8 @@ use crate::request::HttpRequest;
/// ## Example /// ## Example
/// ///
/// ```rust /// ```rust
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{web, App}; /// use actix_web::{web, App};
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Debug, Deserialize)] /// #[derive(Debug, Deserialize)]
/// pub enum ResponseType { /// pub enum ResponseType {
@ -99,8 +99,8 @@ impl<T: fmt::Display> fmt::Display for Query<T> {
/// ## Example /// ## Example
/// ///
/// ```rust /// ```rust
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{web, App}; /// use actix_web::{web, App};
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Debug, Deserialize)] /// #[derive(Debug, Deserialize)]
/// pub enum ResponseType { /// pub enum ResponseType {
@ -169,8 +169,8 @@ where
/// ## Example /// ## Example
/// ///
/// ```rust /// ```rust
/// #[macro_use] extern crate serde_derive;
/// use actix_web::{error, web, App, FromRequest, HttpResponse}; /// use actix_web::{error, web, App, FromRequest, HttpResponse};
/// use serde_derive::Deserialize;
/// ///
/// #[derive(Deserialize)] /// #[derive(Deserialize)]
/// struct Info { /// struct Info {