pub struct Migrator { /* private fields */ }Expand description
Upgrades configs through every schema change since their source version.
Implementations§
Source§impl Migrator
impl Migrator
Sourcepub fn with_plugin(self, plugin: impl PluginMigration + 'static) -> Self
pub fn with_plugin(self, plugin: impl PluginMigration + 'static) -> Self
Add the migrations of a third-party plugin.
§Panics
When plugin claims a plugin name another migration already owns.
Sourcepub fn migrate(
&self,
kind: Kind,
from: Option<&str>,
value: Value,
) -> Result<Migrated, MigrateError>
pub fn migrate( &self, kind: Kind, from: Option<&str>, value: Value, ) -> Result<Migrated, MigrateError>
Upgrade value, a kind document, to the current schema.
The release that wrote each object is read from its own version
field, falling back to from and then to 2.0.0, so re-migrating an
output is a no-op.
§Arguments
kind- Which documentvalueis.from- The release that wrotevalue, asx.y.z, used only whenvaluehas noversionfield.value- The config, as JSON.
Sourcepub fn newest_step_version(&self) -> Version
pub fn newest_step_version(&self) -> Version
The newest release any step migrates to.
Sourcepub fn schema_version(&self) -> Version
pub fn schema_version(&self) -> Version
The newest release whose configs this migrator accepts.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Migrator
impl !Send for Migrator
impl !Sync for Migrator
impl !UnwindSafe for Migrator
impl Freeze for Migrator
impl Unpin for Migrator
impl UnsafeUnpin for Migrator
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