Struct CrateVersion

Source
pub struct CrateVersion {
    pub name: String,
    pub vers: Version,
    pub deps: Vec<Dependency>,
    pub cksum: String,
    pub features: HashMap<String, Vec<String>>,
    pub yanked: bool,
    pub links: Option<String>,
    pub v: u32,
    pub features2: HashMap<String, Vec<String>>,
}
Available on crate feature index only.

Fields§

§name: String

The name of the package.

This must only contain alphanumeric, -, or _ characters.

§vers: Version

The version of the package this row is describing.

This must be a valid version number according to the Semantic Versioning 2.0.0 spec at https://semver.org/.

§deps: Vec<Dependency>

Array of direct dependencies of the package.

§cksum: String

A SHA256 checksum of the .crate file.

§features: HashMap<String, Vec<String>>

Set of features defined for the package.

Each feature maps to an array of features or dependencies it enables.

§yanked: bool

Boolean of whether or not this version has been yanked.

§links: Option<String>

The links string value from the package’s manifest, or null if not specified.

This field is optional and defaults to null.

§v: u32

An unsigned 32-bit integer value indicating the schema version of this entry.

If this not specified, it should be interpreted as the default of 1.

Cargo (starting with version 1.51) will ignore versions it does not recognize. 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. Versions older than 1.51 ignore this field, and thus may misinterpret the meaning of the index entry.

The current values are:

  • 1: The schema as documented here, not including newer additions. This is honored in Rust version 1.51 and newer.
  • 2: The addition of the features2 field. This is honored in Rust version 1.60 and newer.
§features2: HashMap<String, Vec<String>>

This optional 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.

Cargo will merge any values listed here with the “features” field.

If this field is included, the “v” field should be set to at least 2.

Registries are not required to use this field for extended feature syntax, they are allowed to include those in the “features” field. Using this is only necessary if the registry wants to support cargo versions older than 1.19, which in practice is only crates.io since those older versions do not support other registries.

Implementations§

Source§

impl CrateVersion

Source

pub fn normalize(&mut self)

“Normalize” a crate version such that any functionally equivalent versions will be identical.

Trait Implementations§

Source§

impl Clone for CrateVersion

Source§

fn clone(&self) -> CrateVersion

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'de> Deserialize<'de> for CrateVersion

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 From<CrateVersion> for Publish

Source§

fn from(value: CrateVersion) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for CrateVersion

Source§

fn eq(&self, other: &CrateVersion) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CrateVersion

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

impl Eq for CrateVersion

Source§

impl StructuralPartialEq for CrateVersion

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

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

Source§

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

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