feat: derive(Debug) on ClientBuilder

main
Zynh0722 2024-02-09 00:55:04 -08:00
parent 1c31f4bc7f
commit c284c446c8
3 changed files with 13 additions and 0 deletions

View File

@ -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>>,

View File

@ -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

View File

@ -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,