pub struct SchemaAhead { /* private fields */ }Expand description
A store written by a build newer than this one: it records migrations
this binary has never heard of. Produced by Store::schema_ahead.
§Why this is its own type, and not a StoreError variant
Opening such a store is not an error and reading it is provably sound —
migrations are additive in effect, so every column an older build selects is
still there (the one DROP TABLE in [crate::migrations] is a table rebuild
that re-selects every prior column). What is not sound is rewriting the
graph: this build would re-extract every file with its older extractor and
replace the newer build’s content with worse content, silently. So the
refusal belongs on the write paths, and the carrier of that refusal has no
business in the type every Store call returns.
The second reason is semver, and it is the binding one. StoreError is a
public enum on a published 1.x crate and is not #[non_exhaustive], so
adding a variant would stop a downstream exhaustive match from compiling —
a breaking change, which in this workspace means a major bump of all seven
crates. A new type is purely additive. Its fields are private and read
through accessors for the same reason: adding one later stays non-breaking.
Implementations§
Source§impl SchemaAhead
impl SchemaAhead
Sourcepub fn store_version(&self) -> u32
pub fn store_version(&self) -> u32
The highest schema version this store records — necessarily one this build does not know.
Sourcepub fn build_version(&self) -> u32
pub fn build_version(&self) -> u32
The highest schema version this build knows how to apply.
Sourcepub fn unknown_versions(&self) -> &[u32]
pub fn unknown_versions(&self) -> &[u32]
Every recorded version this build has never heard of, ascending. Never empty. More than one means the store ran several unknown migrations, not that anything is inconsistent.
Trait Implementations§
Source§impl Clone for SchemaAhead
impl Clone for SchemaAhead
Source§fn clone(&self) -> SchemaAhead
fn clone(&self) -> SchemaAhead
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SchemaAhead
impl Debug for SchemaAhead
Source§impl Display for SchemaAhead
impl Display for SchemaAhead
impl Eq for SchemaAhead
Source§impl Error for SchemaAhead
impl Error for SchemaAhead
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for SchemaAhead
impl PartialEq for SchemaAhead
impl StructuralPartialEq for SchemaAhead
Auto Trait Implementations§
impl Freeze for SchemaAhead
impl RefUnwindSafe for SchemaAhead
impl Send for SchemaAhead
impl Sync for SchemaAhead
impl Unpin for SchemaAhead
impl UnsafeUnpin for SchemaAhead
impl UnwindSafe for SchemaAhead
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.