I'm writing a hardware access library: #libobscura .
A new idea just popped into my mind: use a special structure for anything that does I/O.
struct Io;
impl Io {
fn device_exists(&self) -> io::Result;
...
}
I'm thinking if I had an Io trait, I could abstract it and use a #mock for #testing.
Is anyone else doing it? Is it a good idea?
[#]drivers #Rust #rustlang #AskFedi
=> More informations about this toot | View the thread | More toots from dcz@fosstodon.org
=> View libobscura tag | View mock tag | View testing tag | View drivers tag | View rust tag | View rustlang tag | View askfedi tag This content has been proxied by September (3851b).Proxy Information
text/gemini