impl Trait for Type
does work in this way in Rust. You could implement traits you own on types you don’t own, or implement traits you don’t own on types you own, but you couldn’t implement traits you don’t own on types you don’t own, known as the “orphan rule”. Without this rule, there’s nothing stopping two rival libraries implementing the same trait on the same type using different implementations. If both libraries are imported to the same application, which implementation should the compiler use? A library is capable of breaking another library’s code!
I think you might run into a similar problem. Two conflicting “adapter” libraries would break each other, so you’d need to introduce a bunch of safeguards, both in the code and also in the ecosystem of providing these adapters.
Remember you can always wrap the foreign type inside a data class Wrapper(x: Type)
and implement whatever interfaces you like on that. The same is true for Rust: struct Wrapper(Type);
.