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`].
|
/// A `ClientBuilder` is used to build a [`ClientWithMiddleware`].
|
||||||
///
|
///
|
||||||
/// [`ClientWithMiddleware`]: crate::ClientWithMiddleware
|
/// [`ClientWithMiddleware`]: crate::ClientWithMiddleware
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct ClientBuilder {
|
pub struct ClientBuilder {
|
||||||
client: Client,
|
client: Client,
|
||||||
middleware_stack: Vec<Arc<dyn Middleware>>,
|
middleware_stack: Vec<Arc<dyn Middleware>>,
|
||||||
|
|
|
@ -47,6 +47,12 @@ pub trait Middleware: 'static + Send + Sync {
|
||||||
) -> Result<Response>;
|
) -> 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(not(target_arch = "wasm32"), async_trait::async_trait)]
|
||||||
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
|
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
|
||||||
impl<F> Middleware for F
|
impl<F> Middleware for F
|
||||||
|
|
|
@ -23,6 +23,12 @@ pub trait RequestInitialiser: 'static + Send + Sync {
|
||||||
fn init(&self, req: RequestBuilder) -> RequestBuilder;
|
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
|
impl<F> RequestInitialiser for F
|
||||||
where
|
where
|
||||||
F: Send + Sync + 'static + Fn(RequestBuilder) -> RequestBuilder,
|
F: Send + Sync + 'static + Fn(RequestBuilder) -> RequestBuilder,
|
||||||
|
|
Loading…
Reference in New Issue