pub struct RemoteGitIndex { /* private fields */ }
Available on crate feature git only.
Expand description

Uses a “bare” git index that fetches files directly from the repo instead of using a local checkout, the same as cargo itself.

Uses cargo’s cache

Implementations§

source§

impl RemoteGitIndex

source

pub fn new(index: GitIndex, lock: &FileLock) -> Result<Self, Error>

Creates a new Self that can access and write local cache entries, and contact the remote index to retrieve the latest index information

Note that if a repository does not exist at the local disk path of the provided GitIndex, a full clone will be performed.

source

pub fn into_parts(self) -> (GitIndex, Repository)

Breaks Self into its component parts

This method is useful if you need thread safe access to the repository

source

pub fn with_options<P>( index: GitIndex, progress: P, should_interrupt: &AtomicBool, _lock: &FileLock ) -> Result<Self, Error>
where P: NestedProgress, P::SubProgress: 'static,

Creates a new Self that allows showing of progress of the the potential fetch if the disk location is empty, as well as allowing interruption of the fetch operation.

source

pub fn local(&self) -> &GitIndex

Gets the local index

source

pub fn index_config(&self) -> Result<IndexConfig, Error>

Get the configuration of the index.

See the cargo docs

source

pub fn krate( &self, name: KrateName<'_>, write_cache_entry: bool, lock: &FileLock ) -> Result<Option<IndexKrate>, Error>

Attempts to read the specified crate’s index metadata

An attempt is first made to read the cache entry for the crate, and falls back to reading the metadata from the git blob it is stored in

This method does no network I/O

source

pub fn cached_krate( &self, name: KrateName<'_>, lock: &FileLock ) -> Result<Option<IndexKrate>, Error>

Attempts to read the locally cached crate information

Note this method has improvements over using GitIndex::cached_krate.

In older versions of cargo, only the head commit hash is used as the version for cached crates, which means a fetch invalidates all cached crates, even if they have not been modified in any commits since the previous fetch.

This method does the same thing as cargo, which is to allow either the head commit oid or the blob oid as a version, which is more granular and means the cached crate can remain valid as long as it is not updated in a subsequent fetch. GitIndex::cached_krate cannot take advantage of that though as it does not have access to git and thus cannot know the blob id.

source

pub fn fetch(&mut self, lock: &FileLock) -> Result<(), Error>

Performs a fetch from the remote index repository.

This method performs network I/O.

source

pub fn fetch_with_options<P>( &mut self, progress: P, should_interrupt: &AtomicBool, _lock: &FileLock ) -> Result<(), Error>
where P: NestedProgress, P::SubProgress: 'static,

Same as Self::fetch but allows specifying a progress implementation and allows interruption of the network operations

Trait Implementations§

source§

impl From<RemoteGitIndex> for ComboIndex

Available on crate feature sparse only.
source§

fn from(index: RemoteGitIndex) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more