pub struct Settings { /* private fields */ }
Expand description
Settings connections handle
Implementations§
Source§impl Settings
impl Settings
Sourcepub fn init_at(settings_dir: &Path, service_name: &str) -> Result<Self>
pub fn init_at(settings_dir: &Path, service_name: &str) -> Result<Self>
Open settings for the service_name service in the settings_dir directory
Sourcepub fn read<T: Serialize + DeserializeOwned>(
&self,
name: &str,
) -> Result<Entry<T>>
pub fn read<T: Serialize + DeserializeOwned>( &self, name: &str, ) -> Result<Entry<T>>
Load value from settings. Returns Error::NotFound if no entry found
Sourcepub fn read_or_insert<T: Serialize + DeserializeOwned>(
&self,
name: &str,
default: T,
) -> Result<Entry<T>>
pub fn read_or_insert<T: Serialize + DeserializeOwned>( &self, name: &str, default: T, ) -> Result<Entry<T>>
Load value from settings. Set value to default if not found
Auto Trait Implementations§
impl Freeze for Settings
impl RefUnwindSafe for Settings
impl Send for Settings
impl Sync for Settings
impl Unpin for Settings
impl UnwindSafe for Settings
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