Reorganize method routers for handlers and services (#405)

* Re-organize method routing for handlers

* Re-organize method routing for services

* changelog
This commit is contained in:
David Pedersen
2021-10-24 20:05:16 +00:00
committed by GitHub
parent 0ee7379d4f
commit 7692baf837
57 changed files with 743 additions and 742 deletions
+1 -1
View File
@@ -134,7 +134,7 @@ where
mod tests {
use super::*;
use crate::Server;
use crate::{handler::get, Router};
use crate::{routing::get, Router};
use std::net::{SocketAddr, TcpListener};
#[tokio::test]
+1 -1
View File
@@ -11,7 +11,7 @@ use std::ops::Deref;
/// ```rust,no_run
/// use axum::{
/// extract::ContentLengthLimit,
/// handler::post,
/// routing::post,
/// Router,
/// };
///
+1 -1
View File
@@ -12,7 +12,7 @@ use std::ops::Deref;
/// use axum::{
/// AddExtensionLayer,
/// extract::Extension,
/// handler::get,
/// routing::get,
/// Router,
/// };
/// use std::sync::Arc;
+1 -1
View File
@@ -38,7 +38,7 @@ use tower_service::Service;
/// ```rust
/// use axum::{
/// extract::{extractor_middleware, FromRequest, RequestParts},
/// handler::{get, post},
/// routing::{get, post},
/// Router,
/// };
/// use http::StatusCode;
+1 -1
View File
@@ -16,7 +16,7 @@ use std::ops::Deref;
/// ```rust,no_run
/// use axum::{
/// extract::Form,
/// handler::post,
/// routing::post,
/// Router,
/// };
/// use serde::Deserialize;
+4 -3
View File
@@ -10,7 +10,8 @@
//! ```rust,no_run
//! use axum::{
//! extract::Json,
//! handler::{post, Handler},
//! routing::post,
//! handler::Handler,
//! Router,
//! };
//! use serde::Deserialize;
@@ -39,7 +40,7 @@
//! use axum::{
//! async_trait,
//! extract::{FromRequest, RequestParts},
//! handler::get,
//! routing::get,
//! Router,
//! };
//! use http::{StatusCode, header::{HeaderValue, USER_AGENT}};
@@ -94,7 +95,7 @@
//! use axum::{
//! extract::{self, BodyStream},
//! body::Body,
//! handler::get,
//! routing::get,
//! http::{header::HeaderMap, Request},
//! Router,
//! };
+1 -1
View File
@@ -22,7 +22,7 @@ use std::{
/// ```rust,no_run
/// use axum::{
/// extract::Multipart,
/// handler::post,
/// routing::post,
/// Router,
/// };
/// use futures::stream::StreamExt;
+5 -5
View File
@@ -24,7 +24,7 @@ use std::{
/// ```rust,no_run
/// use axum::{
/// extract::Path,
/// handler::get,
/// routing::get,
/// Router,
/// };
/// use uuid::Uuid;
@@ -46,7 +46,7 @@ use std::{
/// ```rust,no_run
/// use axum::{
/// extract::Path,
/// handler::get,
/// routing::get,
/// Router,
/// };
/// use uuid::Uuid;
@@ -68,7 +68,7 @@ use std::{
/// ```rust,no_run
/// use axum::{
/// extract::Path,
/// handler::get,
/// routing::get,
/// Router,
/// };
/// use serde::Deserialize;
@@ -97,7 +97,7 @@ use std::{
/// ```rust,no_run
/// use axum::{
/// extract::Path,
/// handler::get,
/// routing::get,
/// Router,
/// };
/// use std::collections::HashMap;
@@ -175,7 +175,7 @@ where
mod tests {
use super::*;
use crate::tests::*;
use crate::{handler::get, Router};
use crate::{routing::get, Router};
use std::collections::HashMap;
#[tokio::test]
+1 -1
View File
@@ -12,7 +12,7 @@ use std::ops::Deref;
/// ```rust,no_run
/// use axum::{
/// extract::Query,
/// handler::get,
/// routing::get,
/// Router,
/// };
/// use serde::Deserialize;
+1 -1
View File
@@ -9,7 +9,7 @@ use std::convert::Infallible;
/// ```rust,no_run
/// use axum::{
/// extract::RawQuery,
/// handler::get,
/// routing::get,
/// Router,
/// };
/// use futures::StreamExt;
+4 -4
View File
@@ -94,7 +94,7 @@ where
///
/// ```
/// use axum::{
/// handler::get,
/// routing::get,
/// Router,
/// extract::OriginalUri,
/// http::Uri
@@ -181,7 +181,7 @@ where
/// ```rust,no_run
/// use axum::{
/// extract::BodyStream,
/// handler::get,
/// routing::get,
/// Router,
/// };
/// use futures::StreamExt;
@@ -252,7 +252,7 @@ fn body_stream_traits() {
/// ```rust,no_run
/// use axum::{
/// extract::RawBody,
/// handler::get,
/// routing::get,
/// Router,
/// };
/// use futures::StreamExt;
@@ -326,7 +326,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::{body::Body, handler::post, tests::*, Router};
use crate::{body::Body, routing::post, tests::*, Router};
use http::StatusCode;
#[tokio::test]
+2 -2
View File
@@ -13,7 +13,7 @@ use std::{convert::Infallible, ops::Deref};
/// ```rust,no_run
/// use axum::{
/// extract::TypedHeader,
/// handler::get,
/// routing::get,
/// Router,
/// };
/// use headers::UserAgent;
@@ -140,7 +140,7 @@ impl std::error::Error for TypedHeaderRejection {
#[cfg(test)]
mod tests {
use super::*;
use crate::{handler::get, response::IntoResponse, tests::*, Router};
use crate::{response::IntoResponse, routing::get, tests::*, Router};
#[tokio::test]
async fn typed_header() {
+3 -3
View File
@@ -5,7 +5,7 @@
//! ```
//! use axum::{
//! extract::ws::{WebSocketUpgrade, WebSocket},
//! handler::get,
//! routing::get,
//! response::IntoResponse,
//! Router,
//! };
@@ -96,7 +96,7 @@ use tokio_tungstenite::{
/// Extractor for establishing WebSocket connections.
///
/// Note: This extractor requires the request method to be `GET` so it should
/// always be used with [`get`](crate::handler::get). Requests with other methods will be
/// always be used with [`get`](crate::routing::get). Requests with other methods will be
/// rejected.
///
/// See the [module docs](self) for an example.
@@ -138,7 +138,7 @@ impl WebSocketUpgrade {
/// ```
/// use axum::{
/// extract::ws::{WebSocketUpgrade, WebSocket},
/// handler::get,
/// routing::get,
/// response::IntoResponse,
/// Router,
/// };