pub enum Index<'a> {
Create(&'a Index),
Drop(&'a Index),
Alter {
previous: &'a Index,
next: &'a Index,
},
}Expand description
A single index-level change between two table versions.
Computed by Index::diff.
Variants§
Create(&'a Index)
A new index was created.
Drop(&'a Index)
An existing index was dropped.
Alter
An index was modified (name, columns, uniqueness, or other property changed).
Implementations§
Source§impl<'a> Index<'a>
impl<'a> Index<'a>
Sourcepub fn diff(
cx: &Context<'a>,
previous: &'a [Index],
next: &'a [Index],
) -> Vec<Self>
pub fn diff( cx: &Context<'a>, previous: &'a [Index], next: &'a [Index], ) -> Vec<Self>
Computes the diff between two index slices.
Uses Context to resolve rename hints for both indices and columns.
Indices matched by name (or by rename hint) are compared; unmatched
indices in previous become drops, and unmatched indices in next
become creates.
§Examples
ⓘ
use toasty_core::schema::{db, diff};
let previous = db::Schema::default();
let next = db::Schema::default();
let hints = diff::RenameHints::new();
let cx = diff::Context::new(&previous, &next, &hints);
assert!(diff::Index::diff(&cx, &[], &[]).is_empty());Auto Trait Implementations§
impl<'a> Freeze for Index<'a>
impl<'a> RefUnwindSafe for Index<'a>
impl<'a> Send for Index<'a>
impl<'a> Sync for Index<'a>
impl<'a> Unpin for Index<'a>
impl<'a> UnsafeUnpin for Index<'a>
impl<'a> UnwindSafe for Index<'a>
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