rust

Loosly Coupled Components

Hi Rustaceans, I am a C++ developer looking for some answers from the world of Rust. I am basically trying to implement loose coupling of sw components in a project where dynamic polymorphism is not allowed for performance reasons. To me this sounds very rust-ish.

My primary reason for doing this is to be able to mock and stub the component interfaces for automatic testing, and normally I would use abstract base classes for interfaces and inject the components into each other as depencencies.

So to the question... is it possible using basic language features to create two structs that both implement traits that are used by the other, inject the structs as dependencies to each other and also be able to stub or mock these structs?

7
1
Comments 1