Types common for multiple crates

I plan to implement my project as a bunch of crates. Let's say each crate consist of graphics filters of a similar functionality, say:

  • sharpen
  • pseudo3d
    and others. The rationale behind such a split is that user now can install only these filters they need. Each of thee crates however requires some traits that define common behavior, e.g:

pub trait GpraphicFilter {}

So what is the idiomatic way to provide these traits and structs that will be shared between all the crates? Should I put them into another crate, say filter_base , filter_def, etc and them import that crate in all others?

Yes, using a shared base crate is the recommended way to set something like that up.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.