Struct tame_index::index::git::GitIndex
source · pub struct GitIndex {
pub head: Option<[u8; 40]>,
/* private fields */
}
Expand description
Allows access to a cargo git registry index
Uses Cargo’s cache.
Fields§
§head: Option<[u8; 40]>
The sha-1 head commit id encoded as hex
Implementations§
source§impl GitIndex
impl GitIndex
sourcepub fn new(il: IndexLocation<'_>) -> Result<Self, Error>
pub fn new(il: IndexLocation<'_>) -> Result<Self, Error>
Creates a new git index for the specified location
sourcepub fn set_head_commit(&mut self, commit_id: Option<[u8; 20]>)
pub fn set_head_commit(&mut self, commit_id: Option<[u8; 20]>)
Sets the sha-1 id for the head commit.
If set, this will be used to disregard cache entries that do not match
sourcepub fn head_commit(&self) -> Option<&str>
pub fn head_commit(&self) -> Option<&str>
Gets the hex-encoded sha-1 id for the head commit
sourcepub fn cached_krate(
&self,
name: KrateName<'_>,
lock: &FileLock
) -> Result<Option<IndexKrate>, Error>
pub fn cached_krate( &self, name: KrateName<'_>, lock: &FileLock ) -> Result<Option<IndexKrate>, Error>
Reads a crate from the local cache of the index.
There are no guarantees around freshness, and no network I/O will be performed.
sourcepub fn write_to_cache(
&self,
krate: &IndexKrate,
blob_id: Option<&str>,
lock: &FileLock
) -> Result<Option<PathBuf>, Error>
pub fn write_to_cache( &self, krate: &IndexKrate, blob_id: Option<&str>, lock: &FileLock ) -> Result<Option<PathBuf>, Error>
Writes the specified crate to the cache.
Note that no I/O will be performed if blob_id
or Self::set_head_commit
has not been set to Some
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GitIndex
impl RefUnwindSafe for GitIndex
impl Send for GitIndex
impl Sync for GitIndex
impl Unpin for GitIndex
impl UnwindSafe for GitIndex
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