1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-25 11:01:14 +00:00

remove useless doctest main fns

This commit is contained in:
Rob Ede 2022-02-22 12:32:06 +00:00
parent ce00c88963
commit 10ef9b0751
No known key found for this signature in database
GPG key ID: 97C636207D3EF933
5 changed files with 43 additions and 54 deletions

View file

@ -96,18 +96,18 @@ impl NamedFile {
///
/// # Examples
/// ```ignore
/// use std::{
/// io::{self, Write as _},
/// env,
/// fs::File
/// };
/// use actix_files::NamedFile;
/// use std::io::{self, Write};
/// use std::env;
/// use std::fs::File;
///
/// fn main() -> io::Result<()> {
/// let mut file = File::create("foo.txt")?;
/// file.write_all(b"Hello, world!")?;
/// let named_file = NamedFile::from_file(file, "bar.txt")?;
/// # std::fs::remove_file("foo.txt");
/// Ok(())
/// }
/// ```
pub fn from_file<P: AsRef<Path>>(file: File, path: P) -> io::Result<NamedFile> {
let path = path.as_ref().to_path_buf();

View file

@ -290,12 +290,10 @@ where
/// Ok(HttpResponse::Ok().into())
/// }
///
/// fn main() {
/// let app = App::new()
/// .service(web::resource("/index.html").route(
/// web::get().to(index)))
/// .external_resource("youtube", "https://youtube.com/watch/{video_id}");
/// }
/// ```
pub fn external_resource<N, U>(mut self, name: N, url: U) -> Self
where

View file

@ -118,12 +118,10 @@ pub trait FromRequest: Sized {
/// }
/// }
///
/// fn main() {
/// let app = App::new().service(
/// web::resource("/users/:first").route(
/// web::post().to(index))
/// );
/// }
/// ```
impl<T> FromRequest for Option<T>
where
@ -205,11 +203,9 @@ where
/// }
/// }
///
/// fn main() {
/// let app = App::new().service(
/// web::resource("/users/:first").route(web::post().to(index))
/// );
/// }
/// ```
impl<T, E> FromRequest for Result<T, E>
where

View file

@ -407,12 +407,10 @@ impl Drop for HttpRequest {
/// format!("Got thing: {:?}", req)
/// }
///
/// fn main() {
/// let app = App::new().service(
/// web::resource("/users/{first}").route(
/// web::get().to(index))
/// );
/// }
/// ```
impl FromRequest for HttpRequest {
type Error = Error;

View file

@ -93,7 +93,6 @@ where
/// "Welcome!"
/// }
///
/// fn main() {
/// let app = App::new()
/// .service(
/// web::resource("/app")
@ -105,7 +104,6 @@ where
/// .guard(guard::Header("content-type", "text/json"))
/// .route(web::get().to(|| HttpResponse::MethodNotAllowed()))
/// );
/// }
/// ```
pub fn guard<G: Guard + 'static>(mut self, guard: G) -> Self {
self.guards.push(Box::new(guard));
@ -137,14 +135,13 @@ where
/// ```
/// use actix_web::{web, guard, App};
///
/// fn main() {
/// let app = App::new().service(
/// web::resource("/container/")
/// .route(web::get().to(get_handler))
/// .route(web::post().to(post_handler))
/// .route(web::delete().to(delete_handler))
/// );
/// }
///
/// # async fn get_handler() -> impl actix_web::Responder { actix_web::HttpResponse::Ok() }
/// # async fn post_handler() -> impl actix_web::Responder { actix_web::HttpResponse::Ok() }
/// # async fn delete_handler() -> impl actix_web::Responder { actix_web::HttpResponse::Ok() }