pub struct Settings<AE: AsyncExecutor> { /* private fields */ }Expand description
Configuration settings with type-safe access.
Values are resolved in this order:
- Explicit overrides set via SettingsBuilder
- Environment variables (if not disabled)
- Default value from the Key definition
Implementations§
Source§impl<AE: AsyncExecutor> Settings<AE>
impl<AE: AsyncExecutor> Settings<AE>
Sourcepub fn get<T: SettingType + Copy>(&self, key: &Key<T>) -> T
pub fn get<T: SettingType + Copy>(&self, key: &Key<T>) -> T
Get a setting value with compile-time type safety.
Resolution order: override -> environment -> default
Sourcepub fn set<T: SettingType>(&mut self, key: &Key<T>, value: T)
pub fn set<T: SettingType>(&mut self, key: &Key<T>, value: T)
Set a setting value with compile-time type safety.
Trait Implementations§
Auto Trait Implementations§
impl<AE> Freeze for Settings<AE>where
AE: Freeze,
impl<AE> RefUnwindSafe for Settings<AE>where
AE: RefUnwindSafe,
impl<AE> Send for Settings<AE>
impl<AE> Sync for Settings<AE>
impl<AE> Unpin for Settings<AE>where
AE: Unpin,
impl<AE> UnsafeUnpin for Settings<AE>where
AE: UnsafeUnpin,
impl<AE> UnwindSafe for Settings<AE>where
AE: UnwindSafe,
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
Mutably borrows from an owned value. Read more