pub enum ServerConfigVersionedDefaulted<'a> {
Versioned(ServerConfigVersioned<'a>),
Unversioned(ServerSettings),
}Expand description
Top-Level struct that wraps ServerConfigVersioned and a default version thereof if no version field exists.
This is required as serde does not have a concept of default_tag yet, see https://github.com/serde-rs/serde/issues/2231
Variants§
Versioned(ServerConfigVersioned<'a>)
Case if config contains a version field
Unversioned(ServerSettings)
Case if the config does not contain a version field, assume type of ServerConfigVersioned::V2
Implementations§
Source§impl<'a> ServerConfigVersionedDefaulted<'a>
impl<'a> ServerConfigVersionedDefaulted<'a>
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
Read a config file, needs to be toml formatted
Sourcepub fn from_config_path() -> Result<Self>
pub fn from_config_path() -> Result<Self>
Read a config file from the default set app-path
Sourcepub fn save_file<'b, P: AsRef<Path>>(
path: P,
config: &'b ServerSettings,
) -> Result<()>
pub fn save_file<'b, P: AsRef<Path>>( path: P, config: &'b ServerSettings, ) -> Result<()>
Save type used by the application as a config file
Will only save the latest version
Sourcepub fn save_config_path(config: &ServerSettings) -> Result<()>
pub fn save_config_path(config: &ServerSettings) -> Result<()>
Save the given config to the default set app-path
Sourcepub fn into_settings(self) -> ServerSettings
pub fn into_settings(self) -> ServerSettings
Convert Into the type used by the application, instead of what is parsed
Will convert any version into the latest
Trait Implementations§
Source§impl<'a> Clone for ServerConfigVersionedDefaulted<'a>
impl<'a> Clone for ServerConfigVersionedDefaulted<'a>
Source§fn clone(&self) -> ServerConfigVersionedDefaulted<'a>
fn clone(&self) -> ServerConfigVersionedDefaulted<'a>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for ServerConfigVersionedDefaulted<'a>
impl<'a> Debug for ServerConfigVersionedDefaulted<'a>
Source§impl<'a, 'de> Deserialize<'de> for ServerConfigVersionedDefaulted<'a>
impl<'a, 'de> Deserialize<'de> for ServerConfigVersionedDefaulted<'a>
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
Auto Trait Implementations§
impl<'a> Freeze for ServerConfigVersionedDefaulted<'a>
impl<'a> RefUnwindSafe for ServerConfigVersionedDefaulted<'a>
impl<'a> Send for ServerConfigVersionedDefaulted<'a>
impl<'a> Sync for ServerConfigVersionedDefaulted<'a>
impl<'a> Unpin for ServerConfigVersionedDefaulted<'a>
impl<'a> UnwindSafe for ServerConfigVersionedDefaulted<'a>
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
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>
Converts
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>
Converts
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