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 PackageIds to Packages. 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.

§

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