pub struct Config {
pub host: String,
pub port: usize,
}Fields§
§host: String§port: usizeImplementations§
Source§impl Config
impl Config
Sourcepub fn parse_toml<P: AsRef<Path>>(toml_path: P) -> Result<Self>
pub fn parse_toml<P: AsRef<Path>>(toml_path: P) -> Result<Self>
Parse a TOML config file. If the file can’t be found, default settings are assumed and returned.
Sourcepub fn write_toml<P: AsRef<Path>>(
&self,
toml_path: P,
overwrite_policy: OverwritePolicy,
) -> Result<()>
pub fn write_toml<P: AsRef<Path>>( &self, toml_path: P, overwrite_policy: OverwritePolicy, ) -> Result<()>
Write self to a TOML config file @ toml_path.
If overwrite_policy is OverwritePolicy::Overwrite, the file will
be written regardless of whether or not it previously existed.
However, if overwrite_policy is OverwritePolicy::DontOverwrite, the
file will only be written iff. it did not previously exist.
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Config
impl Ord for Config
Source§impl PartialOrd for Config
impl PartialOrd for Config
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin 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
Mutably borrows from an owned value. Read more