pub struct ConfigMigrator { /* private fields */ }Expand description
Migrates a user config by adding missing parameters as commented-out entries.
The canonical reference is embedded from config/default.toml at compile time.
User values are never modified; only missing keys are appended as comments.
Implementations§
Source§impl ConfigMigrator
impl ConfigMigrator
Sourcepub fn new() -> ConfigMigrator
pub fn new() -> ConfigMigrator
Create a new migrator using the embedded canonical reference config.
Sourcepub fn migrate(&self, user_toml: &str) -> Result<MigrationResult, MigrateError>
pub fn migrate(&self, user_toml: &str) -> Result<MigrationResult, MigrateError>
Migrate user_toml: add missing parameters from the reference as commented-out entries.
§Errors
Returns MigrateError::Parse if the user’s TOML is invalid.
Returns MigrateError::Reference if the embedded reference TOML cannot be parsed.
§Panics
Never panics in practice; .expect("checked") is unreachable because is_table() is
verified on the same ref_item immediately before calling as_table().
Trait Implementations§
Source§impl Default for ConfigMigrator
impl Default for ConfigMigrator
Source§fn default() -> ConfigMigrator
fn default() -> ConfigMigrator
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConfigMigrator
impl RefUnwindSafe for ConfigMigrator
impl Send for ConfigMigrator
impl Sync for ConfigMigrator
impl Unpin for ConfigMigrator
impl UnsafeUnpin for ConfigMigrator
impl UnwindSafe for ConfigMigrator
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request