[−][src]Struct gitmap::Repo
Structure properties.
Methods
impl Repo
[src]
Repo functions.
pub fn init<P: AsRef<Path>>(path: P) -> Result<Self, Error>
[src]
Creates a new --bare
repository in the specified folder.
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, Error>
[src]
Opens an existing repository.
pub fn path(&self) -> &Path
[src]
Returns repository path.
pub fn len(&self) -> usize
[src]
Returns the number of all keys.
pub fn has_commits(&self) -> bool
[src]
Returns true if repository has no commits.
pub fn has_branches(&self) -> bool
[src]
Returns true if at least one branch exists.
pub fn has_keys(&self) -> bool
[src]
Returns true if at least one key exists.
pub fn has_branch(&self, name: &str) -> bool
[src]
Returns true if the provided branch exists.
pub fn has_key(&self, name: &str) -> bool
[src]
Returns true if the key exists.
pub fn branches(&self) -> Vec<String>
[src]
Returns working branch name.
pub fn keys(&self) -> Vec<String>
[src]
List all available keys.
pub fn branch(&self) -> Option<String>
[src]
Returns working branch name.
pub fn key(&self, name: &str) -> Option<Vec<u8>>
[src]
Retrieves key content.
pub fn switch_branch(&mut self, name: &str) -> Result<(), Error>
[src]
Ensures new working branch. There must be at least one commit in the repository for this method to work other wise the error is thrown.
pub fn remove_branch(&mut self, name: &str) -> Result<(), Error>
[src]
Removes working branch. Note that the current branch can not be removed and you have to first switch to a new branch.
pub fn insert_key(&mut self, name: &str, value: &[u8]) -> Result<(), Error>
[src]
Stages key for commit.
pub fn reset_key(&mut self, name: &str) -> Result<(), Error>
[src]
Stages key for removal.
pub fn remove_key(&mut self, name: &str) -> Result<(), Error>
[src]
Stages key for removal.
pub fn changed(&self) -> bool
[src]
Returns true if any key has been changed.
pub fn key_changed(&self, name: &str) -> bool
[src]
Returns true if the key content has been changed.
pub fn reset(&mut self) -> Result<(), Error>
[src]
Reset all keys.
pub fn remove(&mut self) -> Result<(), Error>
[src]
Remove all keys.
pub fn commit(&self, message: &str) -> Result<(), Error>
[src]
Commit data.
Auto Trait Implementations
impl RefUnwindSafe for Repo
impl Send for Repo
impl !Sync for Repo
impl Unpin for Repo
impl UnwindSafe for Repo
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,