Trait git_repository::easy::Access [−][src]
pub trait Access {
type RepoRef: Deref<Target = Repository>;
type RepoRefMut: DerefMut<Target = Repository>;
fn repo(&self) -> Result<Self::RepoRef>;
fn repo_mut(&self) -> Result<Self::RepoRefMut>;
fn state(&self) -> &State;
}
Expand description
A utility trait to represent access to a repository.
It provides immutable and possibly mutable access. Both types of access are validated at runtime, which may fail or may block, depending on the implementation.
Furthermore it provides access to additional state for use with the Repository
. It is designed for thread-local
mutable access, which is checked at runtime as well. This means that operations can’t freely be interleaved and some
care as to be taken especially in conjunction with ObjectRef
instances.
Associated Types
type RepoRef: Deref<Target = Repository>
type RepoRef: Deref<Target = Repository>
The type of a shared borrow to the Repository
type RepoRefMut: DerefMut<Target = Repository>
type RepoRefMut: DerefMut<Target = Repository>
The type of a mutable borrow to the Repository
Required methods
Return a shared borrow to the repository.
This may fail if there already is a mutable borrow
fn repo_mut(&self) -> Result<Self::RepoRefMut>
fn repo_mut(&self) -> Result<Self::RepoRefMut>
Returns a mutable borrow to the repository if possible.
NOTE
This may not be supported by all implementations. Choosing an implementation that does support it is particularly relevant for long-running applications that make changes to the repository.