pub struct Config {
pub device: Option<String>,
pub format: Option<String>,
pub no_color: bool,
pub fahrenheit: bool,
pub inhg: bool,
pub bq: bool,
pub timeout: Option<u64>,
pub aliases: HashMap<String, String>,
pub last_device: Option<String>,
pub last_device_name: Option<String>,
pub behavior: BehaviorConfig,
pub gui: GuiConfig,
}Expand description
Configuration file structure
Fields§
§device: Option<String>Default device address
format: Option<String>Default output format
no_color: boolDisable colored output
fahrenheit: boolUse Fahrenheit for temperature
inhg: boolUse inHg for pressure (instead of hPa)
bq: boolUse Bq/m³ for radon (instead of pCi/L)
timeout: Option<u64>Connection timeout in seconds
aliases: HashMap<String, String>Device aliases (friendly name -> device address)
last_device: Option<String>Last successfully connected device (auto-updated)
last_device_name: Option<String>Name of the last connected device (for display)
behavior: BehaviorConfigBehavior settings for unified data architecture
gui: GuiConfigGUI-specific settings
Implementations§
Source§impl Config
impl Config
Sourcepub fn path() -> PathBuf
pub fn path() -> PathBuf
Get the config file path.
Checks ARANET_CONFIG_DIR first, then falls back to the platform config directory.
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load config from the default path.
Returns an error if the file exists but cannot be read or parsed.
Sourcepub fn load_or_default() -> Result<Self>
pub fn load_or_default() -> Result<Self>
Load config from the default path, returning defaults when the file is absent.
Returns an error if the file exists but cannot be read or parsed.
Sourcepub fn load_from_path(path: &Path) -> Result<Self>
pub fn load_from_path(path: &Path) -> Result<Self>
Load config from an explicit path.
Sourcepub fn load_from_path_or_default(path: &Path) -> Result<Self>
pub fn load_from_path_or_default(path: &Path) -> Result<Self>
Load config from an explicit path, returning defaults when the file is absent.
Sourcepub fn load_or_default_logged() -> Self
pub fn load_or_default_logged() -> Self
Load config from the default path, logging a warning and falling back to defaults on error.
This helper is for non-fatal UI paths that should remain usable while still surfacing broken config files in the logs.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more