forked from mirror/reqwest-middleware
feat: derive(Debug) on ClientBuilder
parent
1c31f4bc7f
commit
c284c446c8
|
@ -14,6 +14,7 @@ use crate::RequestInitialiser;
|
|||
/// A `ClientBuilder` is used to build a [`ClientWithMiddleware`].
|
||||
///
|
||||
/// [`ClientWithMiddleware`]: crate::ClientWithMiddleware
|
||||
#[derive(Debug)]
|
||||
pub struct ClientBuilder {
|
||||
client: Client,
|
||||
middleware_stack: Vec<Arc<dyn Middleware>>,
|
||||
|
|
|
@ -47,6 +47,12 @@ pub trait Middleware: 'static + Send + Sync {
|
|||
) -> Result<Response>;
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for dyn Middleware {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "Middleware")
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
|
||||
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
|
||||
impl<F> Middleware for F
|
||||
|
|
|
@ -23,6 +23,12 @@ pub trait RequestInitialiser: 'static + Send + Sync {
|
|||
fn init(&self, req: RequestBuilder) -> RequestBuilder;
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for dyn RequestInitialiser {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "RequestInitialiser")
|
||||
}
|
||||
}
|
||||
|
||||
impl<F> RequestInitialiser for F
|
||||
where
|
||||
F: Send + Sync + 'static + Fn(RequestBuilder) -> RequestBuilder,
|
||||
|
|
Loading…
Reference in New Issue