cargo::sources::registry::index

# Struct IndexPackage

source

    pub struct IndexPackage<'a> {
        pub name: InternedString,
        pub vers: Version,
        pub deps: Vec<RegistryDependency<'a>>,
        pub features: BTreeMap<InternedString, Vec<InternedString>>,
        pub features2: Option<BTreeMap<InternedString, Vec<InternedString>>>,
        pub cksum: String,
        pub yanked: Option<bool>,
        pub links: Option<InternedString>,
        pub rust_version: Option<RustVersion>,
        pub v: Option<u32>,
    }

Expand description

A single line in the index representing a single version of a package.

## Fields§

§`name: InternedString`

Name of the package.

§`vers: Version`

The version of this dependency.

§`deps: Vec<RegistryDependency<'a>>`

All kinds of direct dependencies of the package, including dev and build dependencies.

§`features: BTreeMap<InternedString, Vec<InternedString>>`

Set of features defined for the package, i.e., `[features]` table.

§`features2: Option<BTreeMap<InternedString, Vec<InternedString>>>`

This field contains features with new, extended syntax. Specifically, namespaced features (`dep:`) and weak dependencies (`pkg?/feat`).

This is separated from `features` because versions older than 1.19 will fail to load due to not being able to parse the new syntax, even with a `Cargo.lock` file.

§`cksum: String`

Checksum for verifying the integrity of the corresponding downloaded package.

§`yanked: Option<bool>`

If `true`, Cargo will skip this version when resolving.

This was added in 2014. Everything in the crates.io index has this set now, so this probably doesn’t need to be an option anymore.

§`links: Option<InternedString>`

Native library name this package links to.

Added early 2018 (see https://github.com/rust-lang/cargo/pull/4978), can be `None` if published before then.

§`rust_version: Option<RustVersion>`

Required version of rust

Corresponds to `package.rust-version`.

Added in 2023 (see https://github.com/rust-lang/crates.io/pull/6267), can be `None` if published before then or if not set in the manifest.

§`v: Option<u32>`

The schema version for this entry.

If this is None, it defaults to version `1`. Entries with unknown versions are ignored.

Version `2` schema adds the `features2` field.

Version `3` schema adds `artifact`, `bindep_targes`, and `lib` for artifact dependencies support.

This provides a method to safely introduce changes to index entries and allow older versions of cargo to ignore newer entries it doesn’t understand. This is honored as of 1.51, so unfortunately older versions will ignore it, and potentially misinterpret version 2 and newer entries.

The intent is that versions older than 1.51 will work with a pre-existing `Cargo.lock`, but they may not correctly process `cargo update` or build a lock from scratch. In that case, cargo may incorrectly select a new package that uses a new index schema. A workaround is to downgrade any packages that are incompatible with the `--precise` flag of `cargo update`.

## Trait Implementations§

source§

### impl<'de: 'a, 'a> Deserialize<'de> for IndexPackage<'a>

source§

#### fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

### impl<'a> Serialize for IndexPackage<'a>

source§

#### fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

## Auto Trait Implementations§

§

### impl<'a> Freeze for IndexPackage<'a>

§

### impl<'a> RefUnwindSafe for IndexPackage<'a>

§

### impl<'a> Send for IndexPackage<'a>

§

### impl<'a> Sync for IndexPackage<'a>

§

### impl<'a> Unpin for IndexPackage<'a>

§

### impl<'a> UnwindSafe for IndexPackage<'a>

## 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> Serialize for T
where T: Serialize + ?Sized,

source§

#### fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

source§

#### fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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

### impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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