pub struct Index {
pub entries: HashMap<String, IndexEntry>,
}Expand description
The staging area (index)
Fields§
§entries: HashMap<String, IndexEntry>Implementations§
Source§impl Index
impl Index
Sourcepub fn load_with_encryption(
repo_path: &Path,
passphrase: Option<&str>,
) -> Result<Self, String>
pub fn load_with_encryption( repo_path: &Path, passphrase: Option<&str>, ) -> Result<Self, String>
Load index from disk with encryption support
Sourcepub fn save_with_encryption(
&self,
repo_path: &Path,
passphrase: Option<&str>,
) -> Result<(), String>
pub fn save_with_encryption( &self, repo_path: &Path, passphrase: Option<&str>, ) -> Result<(), String>
Save index to disk with encryption support
Sourcepub fn add(&mut self, path: String, hash: String, mode: String)
pub fn add(&mut self, path: String, hash: String, mode: String)
Add or update an entry in the index
Sourcepub fn remove(&mut self, path: &str) -> Option<IndexEntry>
pub fn remove(&mut self, path: &str) -> Option<IndexEntry>
Remove an entry from the index
Sourcepub fn sorted_entries(&self) -> Vec<&IndexEntry>
pub fn sorted_entries(&self) -> Vec<&IndexEntry>
Get all entries sorted by path
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Index
impl<'de> Deserialize<'de> for Index
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 Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
impl UnwindSafe for Index
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