Skip to main content

Module edit

Module edit 

Source

Structs§

EditSession
An edit session tracks backups for atomic multi-file operations.

Functions§

atomic_write_bytes
Write bytes to a file atomically (temp file + fsync + rename). Use this instead of std::fs::write for any file that must survive power loss.
backup
Back up a file before editing. Returns the backup path.
contains
Check whether a package is present in a list within the given file.
contains_any
Check whether any of the given package names is present in a list. Reads the file once and checks all names in a single pass. Returns the matched name, or None if no match.
delete_backup
Delete a backup file.
insert
Insert a package into a list. Returns true if inserted, false if already present.
list_packages
List all package names in a list within the given file. Returns an empty vec if the list is not found (not every module has one).
remove
Remove a package from a list. Returns true if removed, false if not found.
restore
Restore a file from its backup. Returns an error if the backup file is missing.