I’m interfacing with a C-library (wxwidgets library to ask a pincode to access smart cards), but I don’t always have a reader at disposal or a GUI (during travis compilation)
So I wanted to write an interface (a trait) and during compilation I wanted to choose an implementation. The real pcsc interface and pincode GUI implementation for normal compilation and a mocked versions when I use a feature.
So I can give a command line option --feature “mock_pcsc mock_pincode”. I tried with pincode, but I did not succeeded to find a nice solution. Is there a pattern which can be used for what I want to do?
When you want to look at the code: https://github.com/ddt-tdd/eidonkey . You have to check the digital-signature feature branch.
I’m writing rust for 2 weeks now, so I don’t know all the tricks yet . I don’t mind to refactor some things.