Enum cargo::util::cache_lock::CacheLockMode
source · pub enum CacheLockMode {
DownloadExclusive,
Shared,
MutateExclusive,
}
Expand description
The style of lock to acquire.
Variants§
DownloadExclusive
A DownloadExclusive
lock ensures that only one cargo is doing
resolution and downloading new packages.
You should use this when downloading new packages or doing resolution.
If another cargo has a MutateExclusive
lock, then an attempt to get
a DownloadExclusive
lock will block.
If another cargo has a Shared
lock, then both can operate
concurrently.
A Shared
lock allows multiple cargos to read from the source files.
You should use this when cargo is reading source files from the
package cache. This is typically done during the build phase, since
cargo only needs to read files during that time. This allows multiple
cargo processes to build concurrently without interfering with one
another, while guarding against other cargos using MutateExclusive
.
If another cargo has a MutateExclusive
lock, then an attempt to get
a Shared
will block.
If another cargo has a DownloadExclusive
lock, then they both can
operate concurrently under the assumption that downloading does not
modify existing source files.
MutateExclusive
A MutateExclusive
lock ensures no other cargo is reading or writing
from the package caches.
You should use this when modifying existing files in the package
cache. For example, things like garbage collection want to avoid
deleting files while other cargos are trying to read (Shared
) or
resolve or download (DownloadExclusive
).
If another cargo has a DownloadExclusive
or Shared
lock, then this
will block until they all release their locks.
Trait Implementations§
source§impl Clone for CacheLockMode
impl Clone for CacheLockMode
source§fn clone(&self) -> CacheLockMode
fn clone(&self) -> CacheLockMode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CacheLockMode
impl Debug for CacheLockMode
source§impl PartialEq for CacheLockMode
impl PartialEq for CacheLockMode
impl Copy for CacheLockMode
impl StructuralPartialEq for CacheLockMode
Auto Trait Implementations§
impl Freeze for CacheLockMode
impl RefUnwindSafe for CacheLockMode
impl Send for CacheLockMode
impl Sync for CacheLockMode
impl Unpin for CacheLockMode
impl UnwindSafe for CacheLockMode
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
DownloadExclusive
: 0 bytesShared
: 0 bytesMutateExclusive
: 0 bytes