papertigers / rust-kstat

Rust kstat bindings for illumos based systems
MIT License
4 stars 2 forks source link

Add builder pattern api #3

Open papertigers opened 5 years ago

papertigers commented 5 years ago

Investigate using a builder pattern instead of all the optionals in the current api.

Reader.module(foo) .inst(1) .read()

ripudamank2 commented 5 years ago

what is this

papertigers commented 5 years ago

Have a look at https://doc.rust-lang.org/1.0.0/style/ownership/builders.html

Basically instead of defining the module, instance, name, and class when calling new(...), it would allow for let reader = KstatReader::new().module("vfs_stat").instance(1)