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

"Official Orphans" #7

Open
Ixrec opened this issue Jul 7, 2018 · 5 comments
Open

"Official Orphans" #7

Ixrec opened this issue Jul 7, 2018 · 5 comments

Comments

@Ixrec
Copy link
Owner

Ixrec commented Jul 7, 2018

Sometimes, there's an impl that probably should exist, and client code probably should not have to provide it via a newtype, but neither the type's crate or the trait's crate is a good home for it. But we still want there to be a single, quasi-"official" home for these impls. As far as I know, Rust has no good answer for this case today.

This issue is for gathering examples of such use cases, and possibly discussing what a targeted solution for it might look like.

The only example I'm currently aware of is a hypothetical diesel-chrono crate.

@Ixrec
Copy link
Owner Author

Ixrec commented Jul 7, 2018

I just noticed that withoutboats thinks mutually exclusive traits are part of the solution (or at least he did back in 2016). That seems significant.

@gbutler69

This comment has been minimized.

@crlf0710
Copy link

serde-json is another example. While it's the defacto standard crate for json types(and quite satisfactory), it is biased for serde usages, and not a neutral representation crate as it should be.

serde-xml is in similar situation (And might be even worse).

@jplatte
Copy link

jplatte commented Jul 30, 2019

I've got two features in the js_int crate, serde and rocket_04, that only serve to add trait implementations. I would argue that the latter would make a bit more sense in its own crate (the former less so because serde feels pretty 'fundamental').

@luxalpa
Copy link

luxalpa commented Dec 28, 2023

I've got two use cases from my projects: speedy + glam and chrono / index_vec + bitcode. The latter one currently has some escape hatch (where bitcode just allows deferring to serde), but the former one is really annoying as glam is being used all over the project and new typing it is just a very big deal (currently using git subtree on glam instead).

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

No branches or pull requests

5 participants