pub struct SnapshotFile {
pub schema: Schema,
/* private fields */
}Expand description
A TOML-serializable snapshot of the database schema at a point in time.
Each time a migration is generated, a corresponding snapshot is written
alongside it. The next generate run loads the most recent snapshot to
compute a diff against the current schema.
The file carries a version number. SnapshotFile::load and the
FromStr implementation reject files whose version does not match the
current format.
§Examples
use toasty_cli::SnapshotFile;
use toasty_core::schema::db::Schema;
let snapshot = SnapshotFile::new(Schema::default());
// Serialize to TOML via the serde impl
let toml_str = toml::to_string_pretty(&snapshot).unwrap();
let restored: SnapshotFile = toml::from_str(&toml_str).unwrap();Fields§
§schema: SchemaThe database schema
Implementations§
Source§impl SnapshotFile
impl SnapshotFile
Trait Implementations§
Source§impl Clone for SnapshotFile
impl Clone for SnapshotFile
Source§fn clone(&self) -> SnapshotFile
fn clone(&self) -> SnapshotFile
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SnapshotFile
impl Debug for SnapshotFile
Source§impl<'de> Deserialize<'de> for SnapshotFile
impl<'de> Deserialize<'de> for SnapshotFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for SnapshotFile
impl Display for SnapshotFile
Source§impl FromStr for SnapshotFile
impl FromStr for SnapshotFile
Auto Trait Implementations§
impl Freeze for SnapshotFile
impl RefUnwindSafe for SnapshotFile
impl Send for SnapshotFile
impl Sync for SnapshotFile
impl Unpin for SnapshotFile
impl UnwindSafe for SnapshotFile
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