Skip to main content

Migrator

Struct Migrator 

Source
pub struct Migrator { /* private fields */ }
Expand description

Upgrades configs through every schema change since their source version.

Implementations§

Source§

impl Migrator

Source

pub fn new() -> Self

A migrator for the engine, the viewer and the first-party plugins.

Source

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.

Source

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 document value is.
  • from - The release that wrote value, as x.y.z, used only when value has no version field.
  • value - The config, as JSON.
Source

pub fn step_ids(&self) -> Vec<&'static str>

The id of every step this migrator can run.

Source

pub fn newest_step_version(&self) -> Version

The newest release any step migrates to.

Source

pub fn schema_version(&self) -> Version

The newest release whose configs this migrator accepts.

Trait Implementations§

Source§

impl Default for Migrator

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.