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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more