mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
remove unneeded methods
This commit is contained in:
parent
88e5059910
commit
eef687ec80
29
src/lib.rs
29
src/lib.rs
@ -27,7 +27,7 @@ pub use actix_web_codegen::*;
|
||||
|
||||
// re-export for convenience
|
||||
pub use actix_http::Response as HttpResponse;
|
||||
pub use actix_http::{body, error, http, Error, HttpMessage, ResponseError, Result};
|
||||
pub use actix_http::{error, http, Error, HttpMessage, ResponseError, Result};
|
||||
|
||||
pub use crate::app::App;
|
||||
pub use crate::extract::FromRequest;
|
||||
@ -154,37 +154,42 @@ pub mod web {
|
||||
Scope::new(path)
|
||||
}
|
||||
|
||||
/// Create **route** without configuration.
|
||||
/// Create *route* without configuration.
|
||||
pub fn route<P: 'static>() -> Route<P> {
|
||||
Route::new()
|
||||
}
|
||||
|
||||
/// Create **route** with `GET` method guard.
|
||||
/// Create *route* with `GET` method guard.
|
||||
pub fn get<P: 'static>() -> Route<P> {
|
||||
Route::get()
|
||||
Route::new().method(Method::GET)
|
||||
}
|
||||
|
||||
/// Create **route** with `POST` method guard.
|
||||
/// Create *route* with `POST` method guard.
|
||||
pub fn post<P: 'static>() -> Route<P> {
|
||||
Route::post()
|
||||
Route::new().method(Method::POST)
|
||||
}
|
||||
|
||||
/// Create **route** with `PUT` method guard.
|
||||
/// Create *route* with `PUT` method guard.
|
||||
pub fn put<P: 'static>() -> Route<P> {
|
||||
Route::put()
|
||||
Route::new().method(Method::PUT)
|
||||
}
|
||||
|
||||
/// Create **route** with `DELETE` method guard.
|
||||
/// Create *route* with `PATCH` method guard.
|
||||
pub fn patch<P: 'static>() -> Route<P> {
|
||||
Route::new().method(Method::PATCH)
|
||||
}
|
||||
|
||||
/// Create *route* with `DELETE` method guard.
|
||||
pub fn delete<P: 'static>() -> Route<P> {
|
||||
Route::delete()
|
||||
Route::new().method(Method::DELETE)
|
||||
}
|
||||
|
||||
/// Create **route** with `HEAD` method guard.
|
||||
/// Create *route* with `HEAD` method guard.
|
||||
pub fn head<P: 'static>() -> Route<P> {
|
||||
Route::new().method(Method::HEAD)
|
||||
}
|
||||
|
||||
/// Create **route** and add method guard.
|
||||
/// Create *route* and add method guard.
|
||||
pub fn method<P: 'static>(method: Method) -> Route<P> {
|
||||
Route::new().method(method)
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ mod tests {
|
||||
use actix_service::Service;
|
||||
use bytes::Bytes;
|
||||
|
||||
use crate::body::{Body, ResponseBody};
|
||||
use crate::dev::{Body, ResponseBody};
|
||||
use crate::http::StatusCode;
|
||||
use crate::test::{init_service, TestRequest};
|
||||
use crate::{web, App};
|
||||
|
20
src/route.rs
20
src/route.rs
@ -60,26 +60,6 @@ impl<P: 'static> Route<P> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Create new `GET` route.
|
||||
pub fn get() -> Route<P> {
|
||||
Route::new().method(Method::GET)
|
||||
}
|
||||
|
||||
/// Create new `POST` route.
|
||||
pub fn post() -> Route<P> {
|
||||
Route::new().method(Method::POST)
|
||||
}
|
||||
|
||||
/// Create new `PUT` route.
|
||||
pub fn put() -> Route<P> {
|
||||
Route::new().method(Method::PUT)
|
||||
}
|
||||
|
||||
/// Create new `DELETE` route.
|
||||
pub fn delete() -> Route<P> {
|
||||
Route::new().method(Method::DELETE)
|
||||
}
|
||||
|
||||
pub(crate) fn finish(self) -> Self {
|
||||
*self.config_ref.borrow_mut() = self.config.storage.clone();
|
||||
self
|
||||
|
@ -451,7 +451,7 @@ mod tests {
|
||||
use actix_service::Service;
|
||||
use bytes::Bytes;
|
||||
|
||||
use crate::body::{Body, ResponseBody};
|
||||
use crate::dev::{Body, ResponseBody};
|
||||
use crate::http::{Method, StatusCode};
|
||||
use crate::test::{block_on, init_service, TestRequest};
|
||||
use crate::{guard, web, App, HttpRequest, HttpResponse};
|
||||
|
Loading…
Reference in New Issue
Block a user