Struct cargo::core::package::PackageSet

source ·
pub struct PackageSet<'cfg> {
    packages: HashMap<PackageId, LazyCell<Package>>,
    sources: RefCell<SourceMap<'cfg>>,
    config: &'cfg Config,
    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 PackageIds to Packages. It will download as needed, or used the cached download if available.

Fields§

§packages: HashMap<PackageId, LazyCell<Package>>§sources: RefCell<SourceMap<'cfg>>§config: &'cfg Config§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<'cfg> PackageSet<'cfg>

source

pub fn new( package_ids: &[PackageId], sources: SourceMap<'cfg>, config: &'cfg Config ) -> CargoResult<PackageSet<'cfg>>

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, 'cfg>>

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<'cfg>, 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<'cfg>, 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<'cfg>>

source

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

source

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

Merge the given set into self.

Auto Trait Implementations§

§

impl<'cfg> !RefUnwindSafe for PackageSet<'cfg>

§

impl<'cfg> !Send for PackageSet<'cfg>

§

impl<'cfg> !Sync for PackageSet<'cfg>

§

impl<'cfg> Unpin for PackageSet<'cfg>

§

impl<'cfg> !UnwindSafe for PackageSet<'cfg>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

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

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