mirror of
https://github.com/tokio-rs/axum.git
synced 2025-10-02 15:24:54 +00:00
Don't derive debug impl for Resource
(#1153)
We don't actually require `B` to be `Debug` but the derived impl does.
This commit is contained in:
parent
bed0b83421
commit
8c9998eab7
@ -6,7 +6,7 @@ use axum::{
|
|||||||
routing::{delete, get, on, post, MethodFilter},
|
routing::{delete, get, on, post, MethodFilter},
|
||||||
Router,
|
Router,
|
||||||
};
|
};
|
||||||
use std::convert::Infallible;
|
use std::{convert::Infallible, fmt};
|
||||||
use tower_service::Service;
|
use tower_service::Service;
|
||||||
|
|
||||||
/// A resource which defines a set of conventional CRUD routes.
|
/// A resource which defines a set of conventional CRUD routes.
|
||||||
@ -47,7 +47,6 @@ use tower_service::Service;
|
|||||||
/// let app = Router::new().merge(users);
|
/// let app = Router::new().merge(users);
|
||||||
/// # let _: Router<axum::body::Body> = app;
|
/// # let _: Router<axum::body::Body> = app;
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct Resource<B = Body> {
|
pub struct Resource<B = Body> {
|
||||||
pub(crate) name: String,
|
pub(crate) name: String,
|
||||||
pub(crate) router: Router<B>,
|
pub(crate) router: Router<B>,
|
||||||
@ -187,6 +186,15 @@ impl<B> From<Resource<B>> for Router<B> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<B> fmt::Debug for Resource<B> {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
f.debug_struct("Resource")
|
||||||
|
.field("name", &self.name)
|
||||||
|
.field("router", &self.router)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user