cloudflare-rs icon indicating copy to clipboard operation
cloudflare-rs copied to clipboard

feat: Derive debug and clone for async client Struct

Open JQiue opened this issue 8 months ago • 3 comments

This pull request enhances the AsyncClient struct by deriving both the Debug and Clone traits. This addresses key usability limitations and improves the client's flexibility within various application architectures.

Motivation:

  • Improved Debuggability (Debug): As previously highlighted in other discussions, the ability to easily inspect the internal state of the AsyncClient during debugging is crucial for diagnosing issues, understanding client configuration, and managing connection pools. Deriving Debug provides a standardized and readily accessible way to achieve this.
  • Enhanced Flexibility (Clone): Deriving Clone enables the creation of independent copies of the AsyncClient. This is essential for scenarios such as:
    • Multi-threaded applications: Passing independent clients to different threads without ownership conflicts. Configuration variations: Creating multiple clients with slightly different configurations (e.g., different timeouts) without modifying the original client.

JQiue avatar Apr 11 '25 07:04 JQiue

How did you test this change?

kennetheversole avatar Apr 17 '25 14:04 kennetheversole

Just like this opened issue #214 , I have the need to derive pDebug and Clone for the async client Struct

JQiue avatar Apr 26 '25 09:04 JQiue

Does deriving DebugandClone` not affect anything

JQiue avatar Apr 26 '25 09:04 JQiue