mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-26 00:00:23 +02: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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user