Trait loadconf::Load
[−]
[src]
pub trait Load: Sized { fn try_fallback_load<S: AsRef<str>, P: AsRef<Path>>(
filename: S,
path: Option<P>
) -> Result<Self, Error>; fn load<S: AsRef<str>>(filename: S) -> Self { ... } fn try_load<S: AsRef<str>>(filename: S) -> Result<Self, Error> { ... } fn fallback_load<S: AsRef<str>, P: AsRef<Path>>(
filename: S,
path: Option<P>
) -> Self { ... } }
Load a struct from a configuration file.
Required Methods
fn try_fallback_load<S: AsRef<str>, P: AsRef<Path>>(
filename: S,
path: Option<P>
) -> Result<Self, Error>
filename: S,
path: Option<P>
) -> Result<Self, Error>
Loads the configuration from the given path or falls back to search if the path is None. Errors if file can't be read or deserialized.
Provided Methods
fn load<S: AsRef<str>>(filename: S) -> Self
Find a configuration file and load the contents, falling back to the default.
Panics
This will panic if there are any issues reading or deserializing the file.
To catch these errors, use try_load
instead.
fn try_load<S: AsRef<str>>(filename: S) -> Result<Self, Error>
Find a configuration file and load the contents, falling back to the default. Errors if file can't be read or deserialized.
fn fallback_load<S: AsRef<str>, P: AsRef<Path>>(
filename: S,
path: Option<P>
) -> Self
filename: S,
path: Option<P>
) -> Self
Loads the configuration from the given path or falls back to search if the path is None.
Panics
This will panic if there are any issues reading or deserializing the file.
To catch these errors, use try_load
instead.
Implementors
impl<C> Load for C where
C: Default + DeserializeOwned,