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:
David Pedersen
2022-10-10 00:23:11 +02:00
committed by GitHub
parent b607ad5823
commit 7420721f4d
2 changed files with 5 additions and 2 deletions
+4
View File
@@ -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)
+1 -2
View File
@@ -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;