oxidecomputer / amd-apcb

AMD Generic Encapsulated Software Architecture Platform Security Processor Configuration Block manipulation library
Mozilla Public License 2.0
14 stars 2 forks source link

Use builder pattern for ApcbIoOptions #115

Closed daym closed 10 months ago

daym commented 11 months ago

Right now, ApcbIoOptions can only be constructed via ApcbIoOptions::default().

It would be nice to allow the user to build any options using the usual Rust builder pattern.

https://rust-unofficial.github.io/patterns/patterns/creational/builder.html

The reason why this is done using functions instead of struct fields:

  1. So we can, in the future, add options (with defaults) without all call sites having to adapt.
  2. So we can have compatibility shims for the deprecated options if we ever decide to change what the options are.