# Struct cargo::sources::registry::RegistryPackage

source ·

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

Expand description

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

## Fields§

§`name: InternedString`§`vers: Version`§`deps: Vec<RegistryDependency<'a>>`§`features: BTreeMap<InternedString, Vec<InternedString>>`§`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`§`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.

§`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` format adds the `features2` field.

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 format. 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 RegistryPackage<'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

## Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

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

const: unstable · source§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

### impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

### impl<T> From<T> for T

const: unstable · source§

#### fn from(t: T) -> T

Returns the argument unchanged.

source§

### impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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.
const: unstable · 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.
const: unstable · 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> DeserializeOwned for Twhere 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: 192 bytes