Edit migrator to make it possible to create static instances

This commit is contained in:
Raphaël Thériault
2020-07-23 17:54:05 -04:00
parent 92646e00b8
commit 435445fbd0
3 changed files with 9 additions and 13 deletions

View File

@@ -6,7 +6,7 @@ use std::slice;
#[derive(Debug)]
pub struct Migrator {
migrations: Cow<'static, [Migration]>,
pub migrations: Cow<'static, [Migration]>,
}
impl Migrator {
@@ -36,13 +36,6 @@ impl Migrator {
})
}
/// Creates a new instance from a static slice of migrations.
pub fn from_static(migrations: &'static [Migration]) -> Self {
Self {
migrations: Cow::Borrowed(migrations),
}
}
/// Get an iterator over all known migrations.
pub fn iter(&self) -> slice::Iter<'_, Migration> {
self.migrations.iter()