pub struct Ledger {
dir: PathBuf,
pub(super) document: Document,
state: LedgerState,
}Fields§
§dir: PathBuf§document: Document§state: LedgerStateImplementations§
Source§impl Ledger
impl Ledger
pub fn open(game_dir: impl AsRef<Path>) -> Ledger
pub fn state(&self) -> LedgerState
pub fn put(&mut self, key: &str, entry: LedgerEntry) -> Result<()>
Sourcepub fn mark_installed(&mut self, key: &str) -> Result<()>
pub fn mark_installed(&mut self, key: &str) -> Result<()>
Separate from put, so a write-ahead entry and a finished one cannot be confused.
pub fn remove(&mut self, key: &str) -> Result<()>
Sourcepub fn replace_all(
&mut self,
packages: BTreeMap<String, LedgerEntry>,
) -> Result<()>
pub fn replace_all( &mut self, packages: BTreeMap<String, LedgerEntry>, ) -> Result<()>
What restoring a point does.
Sourcepub fn save_snapshot(&self, path: &Path) -> Result<()>
pub fn save_snapshot(&self, path: &Path) -> Result<()>
The packages alone, as replace_all takes them back.
Sourcepub fn read_snapshot(path: &Path) -> Option<BTreeMap<String, LedgerEntry>>
pub fn read_snapshot(path: &Path) -> Option<BTreeMap<String, LedgerEntry>>
What save_snapshot wrote, or None when it is missing or unreadable.
Source§impl Ledger
impl Ledger
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn packages(&self) -> &BTreeMap<String, LedgerEntry>
pub fn packages(&self) -> &BTreeMap<String, LedgerEntry>
By game/directory/name.
pub fn get(&self, key: &str) -> Option<&LedgerEntry>
Sourcepub fn unfinished(&self) -> Vec<String>
pub fn unfinished(&self) -> Vec<String>
Entries a dead run left mid-install, to deal with before planning anything.
Auto Trait Implementations§
impl Freeze for Ledger
impl RefUnwindSafe for Ledger
impl Send for Ledger
impl Sync for Ledger
impl Unpin for Ledger
impl UnsafeUnpin for Ledger
impl UnwindSafe for Ledger
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