From b26b31f1cebc03608865971697ae20060d9c2fd4 Mon Sep 17 00:00:00 2001 From: Jesse Braham Date: Thu, 5 Dec 2024 05:23:09 -0800 Subject: [PATCH] Mention that config structs should derive `procmacros::BuilderLite` in the API guidelines (#2686) --- documentation/API-GUIDELINES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/API-GUIDELINES.md b/documentation/API-GUIDELINES.md index 414308f02..1dd23c835 100644 --- a/documentation/API-GUIDELINES.md +++ b/documentation/API-GUIDELINES.md @@ -35,6 +35,7 @@ In general, the [Rust API Guidelines](https://rust-lang.github.io/api-guidelines - The `ConfigError` enum should be separate from other `Error` enums used by the driver. - The driver should implement `fn apply_config(&mut self, config: &Config) -> Result<(), ConfigError>`. - In case the driver's configuration is infallible (all possible combinations of options are supported by the hardware), the `ConfigError` should be implemented as an empty `enum`. + - Configuration structs should derive `procmacros::BuilderLite` in order to automatically implement the Builder Lite pattern for them. - If a driver only supports a single peripheral instance, no instance type parameter is necessary. - If a driver implements both blocking and async operations, or only implements blocking operations, but may support asynchronous ones in the future, the driver's type signature must include a `crate::Mode` type parameter. - By default, constructors must configure the driver for blocking mode. The driver must implement `into_async` (and a matching `into_blocking`) function that reconfigures the driver.