From 82c31e760b2ecfedf42af0163d16d197012b8a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gianguido=20Sor=C3=A0?= Date: Mon, 10 Oct 2022 15:52:25 +0200 Subject: [PATCH] document how to add user preferences, general cleanup --- libs/userprefs/src/lib.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/libs/userprefs/src/lib.rs b/libs/userprefs/src/lib.rs index f386636a1..e251d6f6f 100644 --- a/libs/userprefs/src/lib.rs +++ b/libs/userprefs/src/lib.rs @@ -30,9 +30,11 @@ impl From for Error { } } -#[derive( - bincode::Encode, bincode::Decode, PartialEq, Debug, Default, prefsgenerator::GetterSetter, -)] +/// UserPrefs defines the set of all the user preference toggles available for Precursor. +/// Setters and getters are PDDB-aware, and are generated by the `prefsgenerator::GetterSetter` macro. +/// To add a new preference setting just drop a new struct entry in here. +/// The struct field type must be serializable by bincode. +#[derive(prefsgenerator::GetterSetter)] struct UserPrefs { radio_on_on_boot: bool, connect_known_networks_on_boot: bool, @@ -94,11 +96,4 @@ impl Default for Manager { fn default() -> Self { Self::new() } -} - -mod test { - #[test] - fn describe() { - use crate::Manager; - let _m = Manager::new(); -} +} \ No newline at end of file