mirror of
https://github.com/tokio-rs/axum.git
synced 2025-03-26 00:27:01 +01:00
Document RouterService
(#1465)
Not sure what else there is to say :P Fixes https://github.com/tokio-rs/axum/issues/1401
This commit is contained in:
parent
b607ad5823
commit
7420721f4d
2 changed files with 5 additions and 2 deletions
axum/src/routing
|
@ -481,6 +481,10 @@ where
|
|||
}
|
||||
|
||||
/// Convert this router into a [`RouterService`].
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the router was constructed with [`Router::inherit_state`].
|
||||
#[track_caller]
|
||||
pub fn into_service(self) -> RouterService<B> {
|
||||
RouterService::new(self)
|
||||
|
|
|
@ -18,7 +18,7 @@ use crate::{
|
|||
response::Response,
|
||||
};
|
||||
|
||||
/// TOOD: Docs
|
||||
/// A [`Router`] converted into a [`Service`].
|
||||
#[derive(Debug)]
|
||||
pub struct RouterService<B = Body> {
|
||||
routes: HashMap<RouteId, Route<B>>,
|
||||
|
@ -129,7 +129,6 @@ impl<B> Clone for RouterService<B> {
|
|||
impl<B> Service<Request<B>> for RouterService<B>
|
||||
where
|
||||
B: HttpBody + Send + 'static,
|
||||
//S: Send + Sync + 'static,
|
||||
{
|
||||
type Response = Response;
|
||||
type Error = Infallible;
|
||||
|
|
Loading…
Add table
Reference in a new issue