pub struct Snapshot {
pub version: u32,
pub dialect: String,
pub id: String,
pub prev_id: String,
pub tables: BTreeMap<String, SnapshotTable>,
pub enums: BTreeMap<String, SnapshotEnum>,
pub meta: SnapshotMeta,
}Fields§
§version: u32§dialect: String§id: String§prev_id: String§tables: BTreeMap<String, SnapshotTable>§enums: BTreeMap<String, SnapshotEnum>§meta: SnapshotMetaImplementations§
Source§impl Snapshot
impl Snapshot
pub fn empty() -> Self
pub fn from_registry(registry: &SchemaRegistry) -> Self
pub fn to_registry(&self) -> SchemaRegistry
Sourcepub fn read_from_path(path: &str) -> Result<Self, DbCoreError>
pub fn read_from_path(path: &str) -> Result<Self, DbCoreError>
Reads a snapshot from the given path. Returns an empty snapshot if the file does not exist.
§Errors
Returns DbCoreError::SnapshotRead if the file exists but cannot be read or parsed.
Sourcepub fn write_to_path(&self, path: &str) -> Result<(), DbCoreError>
pub fn write_to_path(&self, path: &str) -> Result<(), DbCoreError>
Writes the snapshot to the given path as pretty-printed JSON.
§Errors
Returns DbCoreError::SnapshotWrite if the file cannot be written.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Snapshot
impl<'de> Deserialize<'de> for Snapshot
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
Auto Trait Implementations§
impl Freeze for Snapshot
impl RefUnwindSafe for Snapshot
impl Send for Snapshot
impl Sync for Snapshot
impl Unpin for Snapshot
impl UnsafeUnpin for Snapshot
impl UnwindSafe for Snapshot
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