pub struct TrustedCargoCache { /* private fields */ }Expand description
The Cargo download cache of one project.
Implementations§
Source§impl TrustedCargoCache
impl TrustedCargoCache
Sourcepub fn for_project(cache_root: &Path, main_checkout: &Path) -> Self
pub fn for_project(cache_root: &Path, main_checkout: &Path) -> Self
Returns the cache, under cache_root, of the project whose main
checkout is main_checkout.
Sourcepub async fn refresh(
&self,
cargo: &str,
worktree: &Path,
environment: &BTreeMap<String, String>,
on_fetch: impl FnOnce() + Send,
) -> Result<()>
pub async fn refresh( &self, cargo: &str, worktree: &Path, environment: &BTreeMap<String, String>, on_fetch: impl FnOnce() + Send, ) -> Result<()>
Fetches the crates.io packages that worktree’s Cargo.lock pins
and the cache lacks, calling on_fetch first when it fetches.
Only the lockfile is read, as data. The fetch runs the host’s
cargo executable, which environment’s PATH resolves for a bare
name, for a synthetic workspace that pins exactly those packages, so
that no path, Git, or other registry source is reached. It reads no
Cargo configuration and no credentials at all: it runs in a fresh
directory under the first of environment’s XDG_RUNTIME_DIR and
TMPDIR whose every ancestor only root or the current user can
change, so that no other user can plant configuration above it (a
shared /tmp does not qualify); it is skipped without such a
directory, or when one of
its ancestors holds Cargo configuration or a toolchain file, with
the cache as a CARGO_HOME that holds neither, and with only the
allowed host variables: PATH, HOME, the rustup home and
toolchain, and proxies and certificate authorities. Only archives
from the canonical crates.io registry are recorded, so a host whose
network needs a crates.io mirror gets no shared cache, and its
sessions keep downloading per session. A new Cargo version fetches
again.
§Errors
Returns an error when the cache cannot be written, Cargo fails or times out, or the fetch left a package uncached; what was fetched stays recorded.
Trait Implementations§
Source§impl Clone for TrustedCargoCache
impl Clone for TrustedCargoCache
Source§impl Debug for TrustedCargoCache
impl Debug for TrustedCargoCache
impl Eq for TrustedCargoCache
Source§impl PartialEq for TrustedCargoCache
impl PartialEq for TrustedCargoCache
impl StructuralPartialEq for TrustedCargoCache
Auto Trait Implementations§
impl Forget for TrustedCargoCache
impl Freeze for TrustedCargoCache
impl Move for TrustedCargoCache
impl RefUnwindSafe for TrustedCargoCache
impl Send for TrustedCargoCache
impl Sync for TrustedCargoCache
impl Unpin for TrustedCargoCache
impl UnsafeUnpin for TrustedCargoCache
impl UnwindSafe for TrustedCargoCache
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> ⓘ
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> ⓘ
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