Toot

Written by dorotaC on 2025-01-23 at 13:15

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

Mentions

Tags

=> View libobscura tag | View mock tag | View testing tag | View drivers tag | View rust tag | View rustlang tag | View askfedi tag

Proxy Information
Original URL
gemini://mastogem.picasoft.net/toot/113877851233407275
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
392.021403 milliseconds
Gemini-to-HTML Time
0.756869 milliseconds

This content has been proxied by September (3851b).