cargo::core::package

# Struct PackageSet

source

    pub struct PackageSet<'gctx> {
        packages: HashMap<PackageId, LazyCell<Package>>,
        sources: RefCell<SourceMap<'gctx>>,
        gctx: &'gctx GlobalContext,
        multi: Multi,
        downloading: Cell<bool>,
        multiplexing: bool,
    }

Expand description

A set of packages, with the intent to download.

This is primarily used to convert a set of `PackageId`s to `Package`s. It will download as needed, or used the cached download if available.

## Fields§

§`packages: HashMap<PackageId, LazyCell<Package>>`§`sources: RefCell<SourceMap<'gctx>>`§`gctx: &'gctx GlobalContext`§`multi: Multi`§`downloading: Cell<bool>`

Used to prevent reusing the PackageSet to download twice.

§`multiplexing: bool`

Whether or not to use curl HTTP/2 multiplexing.

## Implementations§

source§

### impl<'gctx> PackageSet<'gctx>

source

#### pub fn new( package_ids: &[PackageId], sources: SourceMap<'gctx>, gctx: &'gctx GlobalContext, ) -> CargoResult<PackageSet<'gctx>>

source

#### pub fn package_ids(&self) -> impl Iterator<Item = PackageId> + '_

source

#### pub fn packages(&self) -> impl Iterator<Item = &Package>

source

#### pub fn enable_download<'a>(&'a self) -> CargoResult<Downloads<'a, 'gctx>>

source

#### pub fn get_one(&self, id: PackageId) -> CargoResult<&Package>

source

#### pub fn get_many( &self, ids: impl IntoIterator<Item = PackageId>, ) -> CargoResult<Vec<&Package>>

source

#### pub fn download_accessible( &self, resolve: &Resolve, root_ids: &[PackageId], has_dev_units: HasDevUnits, requested_kinds: &[CompileKind], target_data: &RustcTargetData<'gctx>, force_all_targets: ForceAllTargets, ) -> CargoResult<()>

Downloads any packages accessible from the give root ids.

source

#### pub(crate) fn warn_no_lib_packages_and_artifact_libs_overlapping_deps( &self, ws: &Workspace<'gctx>, resolve: &Resolve, root_ids: &[PackageId], has_dev_units: HasDevUnits, requested_kinds: &[CompileKind], target_data: &RustcTargetData<'_>, force_all_targets: ForceAllTargets, ) -> CargoResult<()>

Check if there are any dependency packages that violate artifact constraints to instantly abort, or that do not have any libs which results in warnings.

source

#### fn filter_deps<'a>( pkg_id: PackageId, resolve: &'a Resolve, has_dev_units: HasDevUnits, requested_kinds: &'a [CompileKind], target_data: &'a RustcTargetData<'_>, force_all_targets: ForceAllTargets, ) -> impl Iterator<Item = (PackageId, &'a HashSet<Dependency>)> + 'a

source

#### pub fn sources(&self) -> Ref<'_, SourceMap<'gctx>>

source

#### pub fn sources_mut(&self) -> RefMut<'_, SourceMap<'gctx>>

source

#### pub fn add_set(&mut self, set: PackageSet<'gctx>)

Merge the given set into self.

## Auto Trait Implementations§

§

### impl<'gctx> !Freeze for PackageSet<'gctx>

§

### impl<'gctx> !RefUnwindSafe for PackageSet<'gctx>

§

### impl<'gctx> !Send for PackageSet<'gctx>

§

### impl<'gctx> !Sync for PackageSet<'gctx>

§

### impl<'gctx> Unpin for PackageSet<'gctx>

§

### impl<'gctx> !UnwindSafe for PackageSet<'gctx>

## 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.

§

### impl<T> Instrument for T

§

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

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

#### 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> IntoEither for T

source§

#### 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 more
source§

#### fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

### impl<T> Pointable for T

§

#### const ALIGN: usize = _

The alignment of pointer.
§

#### type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

#### unsafe fn drop(ptr: usize)

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

### impl<T> Same for T

source§

#### type Output = T

Should always be `Self`
source§

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

source§

#### 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>,

source§

#### 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.
§

### impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

#### fn vzip(self) -> V

§

### impl<T> WithSubscriber for T

§

#### 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
§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

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

## 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: 136 bytes