marshallpierce / rust-base64

base64, in rust
Apache License 2.0
616 stars 115 forks source link

GeneralPurpose engine should implement Clone and Debug #242

Closed xfbs closed 1 year ago

xfbs commented 1 year ago

The problem

How I, the issue filer, am going to help solve it

marshallpierce commented 1 year ago

I'm curious, what's the use case? Why would you be comparing engine instances, or using them as map keys? Or using Debug to see their internal lookup tables, etc?

Kinrany commented 1 year ago

It would be nice to be able to store a dynamically selected engine in a cloneable struct.

Though the more general argument is that foreseeing all use cases is impossible and Rust does not allow implementing traits in depending crates: https://rust-lang.github.io/api-guidelines/interoperability.html#c-common-traits

marshallpierce commented 1 year ago

I see, I can buy that. Is it just that you want Debug to exist at all, and the derived (likely verbose and not hat helpful) impl is okay? Or you want Debug to show something in particular?

Kinrany commented 1 year ago

The derived impl is fine, and it can always be changed later because Debug is explicitly not stable.

And yeah, in many cases it's important for a trait impl to just exist at all because that allows using the type in other types that derive the trait.

Traits are additive, having more of them implemented is almost always good.

marshallpierce commented 1 year ago

I'll release a new version with the fix soon.

marshallpierce commented 1 year ago

0.21.5 released with this fix.