mirror of
https://github.com/tokio-rs/axum.git
synced 2024-11-22 23:30:29 +01: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
1 changed files with 10 additions and 2 deletions
|
@ -6,7 +6,7 @@ use axum::{
|
|||
routing::{delete, get, on, post, MethodFilter},
|
||||
Router,
|
||||
};
|
||||
use std::convert::Infallible;
|
||||
use std::{convert::Infallible, fmt};
|
||||
use tower_service::Service;
|
||||
|
||||
/// 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 _: Router<axum::body::Body> = app;
|
||||
/// ```
|
||||
#[derive(Debug)]
|
||||
pub struct Resource<B = Body> {
|
||||
pub(crate) name: String,
|
||||
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)]
|
||||
mod tests {
|
||||
#[allow(unused_imports)]
|
||||
|
|
Loading…
Reference in a new issue