pub struct ConfigMigrationRule { /* private fields */ }
Expand description
Rule to migrate deprecated config variables.
Implementations§
Source§impl ConfigMigrationRule
impl ConfigMigrationRule
Sourcepub fn rename_value(
old_name: impl ToConfigNamePath,
new_name: impl ToConfigNamePath,
) -> Self
pub fn rename_value( old_name: impl ToConfigNamePath, new_name: impl ToConfigNamePath, ) -> Self
Creates rule that moves value from old_name
to new_name
.
Sourcepub fn rename_update_value(
old_name: impl ToConfigNamePath,
new_name: impl ToConfigNamePath,
new_value_fn: impl Fn(&ConfigValue) -> Result<ConfigValue, Box<dyn Error + Send + Sync>> + 'static,
) -> Self
pub fn rename_update_value( old_name: impl ToConfigNamePath, new_name: impl ToConfigNamePath, new_value_fn: impl Fn(&ConfigValue) -> Result<ConfigValue, Box<dyn Error + Send + Sync>> + 'static, ) -> Self
Creates rule that moves value from old_name
to new_name
, and updates
the value.
If new_value_fn(&old_value)
returned an error, the whole migration
process would fail.
Sourcepub fn custom(
matches_fn: impl Fn(&ConfigLayer) -> bool + 'static,
apply_fn: impl Fn(&mut ConfigLayer) -> Result<String, ConfigMigrateLayerError> + 'static,
) -> Self
pub fn custom( matches_fn: impl Fn(&ConfigLayer) -> bool + 'static, apply_fn: impl Fn(&mut ConfigLayer) -> Result<String, ConfigMigrateLayerError> + 'static, ) -> Self
Creates rule that updates config layer by apply_fn
. match_fn
should
return true if the layer contains items to be updated.
Auto Trait Implementations§
impl Freeze for ConfigMigrationRule
impl !RefUnwindSafe for ConfigMigrationRule
impl !Send for ConfigMigrationRule
impl !Sync for ConfigMigrationRule
impl Unpin for ConfigMigrationRule
impl !UnwindSafe for ConfigMigrationRule
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 more