A crate for the interoperation of other crates - thoughts

I'm planning to publish a crate that should define traits, structs of public fields and enums for the interoperation of other crates.
More specifically the crate should provide an idiomatic API in Rust for the ZigBee network so that it would be possible for the client crates to implement parts of the specification and let their clients choose how to connect the parts using Rustic features like trait objects at this purpose.
For example a crate could implement the Application Layer of the protocol and hold as a trait object a link to a device driver, like a dongle, that would implement the network and lower layers.
I would like to know what do you think about this idea.

That may be useful, especially if there are common structs that need to be shared between multiple libraries.

Be careful with Rust's orphan rules though. It's not possible to implement other crate's trait for other crate's type (either trait or the type has to be one defined in your own crate). That rule is quite important for consistency and reliability of the language, but may get in your way of providing trait-based interoperability between crates.

1 Like