top | item 36239875

(no title)

rnestler | 2 years ago

> I wanted to separate the type, the trait and the implementation of the trait in different crates.

I usually put the traits in a separate crate, but keep concrete types and implementations for them in the same crate.

What is the use-case for splitting a type and it's implementation into separate crates? (except for cases where the trait or the type are out of your control, then one indeed needs to use the new-type escape hatch)

discuss

order

_nalply|2 years ago

I had three different goals, one for the traits, one for something else where the types fit best, and the third which I achieved with the implementations of the traits.

The problem was that the trait implementations of the types was something like not a core task of the types themselves.