Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyValueMap, Params, RequestTemplate and Client: Clone? #25

Open
peter-lyons-kehl opened this issue May 27, 2022 · 0 comments
Open

KeyValueMap, Params, RequestTemplate and Client: Clone? #25

peter-lyons-kehl opened this issue May 27, 2022 · 0 comments

Comments

@peter-lyons-kehl
Copy link
Contributor

Hi at LogDNA/Mezmo crate maintainer/creator,

Thank you for this Rust library. It works marvels.

I see that you guard your API, to make it future proof/implementation-independent. Like KeyValueMap is a value type around HashMap, rather than HashMap itself.

  1. If you didn't intend KeyValueMap to be Clone, you may want to make it a one-field struct {} rather than a one-field tuple, because a tuple automatically is Clone or even Copy (and I believe it's automatically Debug, too) if all its fields are Clone or Copy (or Debug). Of course, you may have intended KeyValueMap to be Clone, which I'd be thankful for.
    (I've checked and there are no other named tuples around: egrep -r "struct +[a-zA-Z_]+ *\(" src.)

  2. On the other hand, Clone is very handy. For example, Axum requires the (HTTP GET/POST...) service handler function/closure to be Clone (https://docs.rs/axum/latest/axum/handler/trait.Handler.html). Currently there's no way to instantiate one Client, use it before spinning up Axum and pass it to the handler(s), too.

So it would help if KeyValueMap, Params, RequestTemplate and Client (or at least Client and/or RequestTemplate) were Clone, please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant