pub struct Journal {
pub version: u32,
pub entries: Vec<JournalEntry>,
}Fields§
§version: u32§entries: Vec<JournalEntry>Implementations§
Source§impl Journal
impl Journal
pub fn empty() -> Self
pub fn add_entry(&mut self, name: &str, hash: &str)
pub fn next_migration_number(&self) -> u32
pub fn latest_snapshot_name_owned(&self) -> Option<String>
Sourcepub fn read_from_path(path: &str) -> Result<Self, DbCoreError>
pub fn read_from_path(path: &str) -> Result<Self, DbCoreError>
Reads a journal from a JSON file, returning an empty journal if the file does not exist.
§Errors
Returns DbCoreError::JournalRead 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 journal to a JSON file.
§Errors
Returns DbCoreError::JournalWrite if serialization or file writing fails.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Journal
impl<'de> Deserialize<'de> for Journal
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 Journal
impl RefUnwindSafe for Journal
impl Send for Journal
impl Sync for Journal
impl Unpin for Journal
impl UnsafeUnpin for Journal
impl UnwindSafe for Journal
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