1use crate::crates::CrateId;
4use crate::ignore::IgnoredStr;
5use crate::users::UserId;
6use chrono::{DateTime, Utc};
7use semver::{BuildMetadata, Op, Version, VersionReq};
8use serde::de::{Deserialize, Deserializer, Unexpected, Visitor};
9use serde_derive::{Deserialize, Serialize};
10use std::borrow::Borrow;
11use std::cmp::Ordering;
12use std::collections::BTreeMap as Map;
13use std::fmt;
14use std::hash::{Hash, Hasher};
15use std::str::FromStr;
16
17#[derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl _serde::Serialize for VersionId {
fn serialize<__S>(&self, __serializer: __S)
-> _serde::__private228::Result<__S::Ok, __S::Error> where
__S: _serde::Serializer {
_serde::Serialize::serialize(&self.0, __serializer)
}
}
};Serialize, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for VersionId {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Result::map(_serde::Deserialize::deserialize(__deserializer),
|__transparent| VersionId { 0: __transparent })
}
}
};Deserialize, #[automatically_derived]
impl ::core::marker::Copy for VersionId { }Copy, #[automatically_derived]
impl ::core::clone::Clone for VersionId {
#[inline]
fn clone(&self) -> VersionId {
let _: ::core::clone::AssertParamIsClone<u32>;
*self
}
}Clone, #[automatically_derived]
impl ::core::cmp::Ord for VersionId {
#[inline]
fn cmp(&self, other: &VersionId) -> ::core::cmp::Ordering {
::core::cmp::Ord::cmp(&self.0, &other.0)
}
}Ord, #[automatically_derived]
impl ::core::cmp::PartialOrd for VersionId {
#[inline]
fn partial_cmp(&self, other: &VersionId)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0)
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for VersionId {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for VersionId {
#[inline]
fn eq(&self, other: &VersionId) -> bool { self.0 == other.0 }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for VersionId {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
::core::hash::Hash::hash(&self.0, state)
}
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for VersionId {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_tuple_field1_finish(f, "VersionId",
&&self.0)
}
}Debug)]
19#[serde(transparent)]
20#[cfg_attr(not(doc), repr(transparent))]
21pub struct VersionId(pub u32);
22
23#[derive(#[automatically_derived]
impl ::core::clone::Clone for Row {
#[inline]
fn clone(&self) -> Row {
Row {
id: ::core::clone::Clone::clone(&self.id),
crate_id: ::core::clone::Clone::clone(&self.crate_id),
num: ::core::clone::Clone::clone(&self.num),
updated_at: ::core::clone::Clone::clone(&self.updated_at),
created_at: ::core::clone::Clone::clone(&self.created_at),
downloads: ::core::clone::Clone::clone(&self.downloads),
features: ::core::clone::Clone::clone(&self.features),
yanked: ::core::clone::Clone::clone(&self.yanked),
license: ::core::clone::Clone::clone(&self.license),
crate_size: ::core::clone::Clone::clone(&self.crate_size),
published_by: ::core::clone::Clone::clone(&self.published_by),
checksum: ::core::clone::Clone::clone(&self.checksum),
links: ::core::clone::Clone::clone(&self.links),
rust_version: ::core::clone::Clone::clone(&self.rust_version),
has_lib: ::core::clone::Clone::clone(&self.has_lib),
bin_names: ::core::clone::Clone::clone(&self.bin_names),
edition: ::core::clone::Clone::clone(&self.edition),
description: ::core::clone::Clone::clone(&self.description),
homepage: ::core::clone::Clone::clone(&self.homepage),
documentation: ::core::clone::Clone::clone(&self.documentation),
repository: ::core::clone::Clone::clone(&self.repository),
categories: ::core::clone::Clone::clone(&self.categories),
keywords: ::core::clone::Clone::clone(&self.keywords),
}
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Row {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["id", "crate_id", "num", "updated_at", "created_at",
"downloads", "features", "yanked", "license", "crate_size",
"published_by", "checksum", "links", "rust_version",
"has_lib", "bin_names", "edition", "description",
"homepage", "documentation", "repository", "categories",
"keywords"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.id, &self.crate_id, &self.num, &self.updated_at,
&self.created_at, &self.downloads, &self.features,
&self.yanked, &self.license, &self.crate_size,
&self.published_by, &self.checksum, &self.links,
&self.rust_version, &self.has_lib, &self.bin_names,
&self.edition, &self.description, &self.homepage,
&self.documentation, &self.repository, &self.categories,
&&self.keywords];
::core::fmt::Formatter::debug_struct_fields_finish(f, "Row", names,
values)
}
}Debug)]
25#[non_exhaustive]
26pub struct Row {
27 pub id: VersionId,
29 pub crate_id: CrateId,
30 pub num: Version,
31 pub updated_at: DateTime<Utc>,
32 pub created_at: DateTime<Utc>,
33 pub downloads: u64,
34 pub features: Map<String, Vec<String>>,
35 pub yanked: bool,
36 pub license: String,
37 pub crate_size: Option<u64>,
38 pub published_by: Option<UserId>,
39 pub checksum: Option<[u8; 32]>,
40 pub links: Option<String>,
41 pub rust_version: Option<Version>,
42 pub has_lib: bool,
43 pub bin_names: Vec<String>,
44 pub edition: Option<u16>,
45 pub description: Option<String>,
46 pub homepage: Option<String>,
47 pub documentation: Option<String>,
48 pub repository: Option<String>,
49 pub categories: Vec<String>,
50 pub keywords: Vec<String>,
51}
52
53impl<'de> Deserialize<'de> for Row {
54 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
55 where
56 D: Deserializer<'de>,
57 {
58 #[derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for Row {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
#[allow(non_camel_case_types)]
#[doc(hidden)]
enum __Field {
__field0,
__field1,
__field2,
__field3,
__field4,
__field5,
__field6,
__field7,
__field8,
__field9,
__field10,
__field11,
__field12,
__field13,
__field14,
__field15,
__field16,
__field17,
__field18,
__field19,
__field20,
__field21,
__field22,
__field23,
}
#[doc(hidden)]
struct __FieldVisitor;
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
type Value = __Field;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"field identifier")
}
fn visit_u64<__E>(self, __value: u64)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
0u64 => _serde::__private228::Ok(__Field::__field0),
1u64 => _serde::__private228::Ok(__Field::__field1),
2u64 => _serde::__private228::Ok(__Field::__field2),
3u64 => _serde::__private228::Ok(__Field::__field3),
4u64 => _serde::__private228::Ok(__Field::__field4),
5u64 => _serde::__private228::Ok(__Field::__field5),
6u64 => _serde::__private228::Ok(__Field::__field6),
7u64 => _serde::__private228::Ok(__Field::__field7),
8u64 => _serde::__private228::Ok(__Field::__field8),
9u64 => _serde::__private228::Ok(__Field::__field9),
10u64 => _serde::__private228::Ok(__Field::__field10),
11u64 => _serde::__private228::Ok(__Field::__field11),
12u64 => _serde::__private228::Ok(__Field::__field12),
13u64 => _serde::__private228::Ok(__Field::__field13),
14u64 => _serde::__private228::Ok(__Field::__field14),
15u64 => _serde::__private228::Ok(__Field::__field15),
16u64 => _serde::__private228::Ok(__Field::__field16),
17u64 => _serde::__private228::Ok(__Field::__field17),
18u64 => _serde::__private228::Ok(__Field::__field18),
19u64 => _serde::__private228::Ok(__Field::__field19),
20u64 => _serde::__private228::Ok(__Field::__field20),
21u64 => _serde::__private228::Ok(__Field::__field21),
22u64 => _serde::__private228::Ok(__Field::__field22),
23u64 => _serde::__private228::Ok(__Field::__field23),
_ =>
_serde::__private228::Err(_serde::de::Error::invalid_value(_serde::de::Unexpected::Unsigned(__value),
&"field index 0 <= i < 24")),
}
}
fn visit_str<__E>(self, __value: &str)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
"id" => _serde::__private228::Ok(__Field::__field0),
"crate_id" => _serde::__private228::Ok(__Field::__field1),
"num" => _serde::__private228::Ok(__Field::__field2),
"num_no_build" =>
_serde::__private228::Ok(__Field::__field3),
"updated_at" => _serde::__private228::Ok(__Field::__field4),
"created_at" => _serde::__private228::Ok(__Field::__field5),
"downloads" => _serde::__private228::Ok(__Field::__field6),
"features" => _serde::__private228::Ok(__Field::__field7),
"yanked" => _serde::__private228::Ok(__Field::__field8),
"license" => _serde::__private228::Ok(__Field::__field9),
"crate_size" =>
_serde::__private228::Ok(__Field::__field10),
"published_by" =>
_serde::__private228::Ok(__Field::__field11),
"checksum" => _serde::__private228::Ok(__Field::__field12),
"links" => _serde::__private228::Ok(__Field::__field13),
"rust_version" =>
_serde::__private228::Ok(__Field::__field14),
"has_lib" => _serde::__private228::Ok(__Field::__field15),
"bin_names" => _serde::__private228::Ok(__Field::__field16),
"edition" => _serde::__private228::Ok(__Field::__field17),
"description" =>
_serde::__private228::Ok(__Field::__field18),
"homepage" => _serde::__private228::Ok(__Field::__field19),
"documentation" =>
_serde::__private228::Ok(__Field::__field20),
"repository" =>
_serde::__private228::Ok(__Field::__field21),
"categories" =>
_serde::__private228::Ok(__Field::__field22),
"keywords" => _serde::__private228::Ok(__Field::__field23),
_ => {
_serde::__private228::Err(_serde::de::Error::unknown_field(__value,
FIELDS))
}
}
}
fn visit_bytes<__E>(self, __value: &[u8])
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
b"id" => _serde::__private228::Ok(__Field::__field0),
b"crate_id" => _serde::__private228::Ok(__Field::__field1),
b"num" => _serde::__private228::Ok(__Field::__field2),
b"num_no_build" =>
_serde::__private228::Ok(__Field::__field3),
b"updated_at" =>
_serde::__private228::Ok(__Field::__field4),
b"created_at" =>
_serde::__private228::Ok(__Field::__field5),
b"downloads" => _serde::__private228::Ok(__Field::__field6),
b"features" => _serde::__private228::Ok(__Field::__field7),
b"yanked" => _serde::__private228::Ok(__Field::__field8),
b"license" => _serde::__private228::Ok(__Field::__field9),
b"crate_size" =>
_serde::__private228::Ok(__Field::__field10),
b"published_by" =>
_serde::__private228::Ok(__Field::__field11),
b"checksum" => _serde::__private228::Ok(__Field::__field12),
b"links" => _serde::__private228::Ok(__Field::__field13),
b"rust_version" =>
_serde::__private228::Ok(__Field::__field14),
b"has_lib" => _serde::__private228::Ok(__Field::__field15),
b"bin_names" =>
_serde::__private228::Ok(__Field::__field16),
b"edition" => _serde::__private228::Ok(__Field::__field17),
b"description" =>
_serde::__private228::Ok(__Field::__field18),
b"homepage" => _serde::__private228::Ok(__Field::__field19),
b"documentation" =>
_serde::__private228::Ok(__Field::__field20),
b"repository" =>
_serde::__private228::Ok(__Field::__field21),
b"categories" =>
_serde::__private228::Ok(__Field::__field22),
b"keywords" => _serde::__private228::Ok(__Field::__field23),
_ => {
let __value =
&_serde::__private228::from_utf8_lossy(__value);
_serde::__private228::Err(_serde::de::Error::unknown_field(__value,
FIELDS))
}
}
}
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::Deserializer::deserialize_identifier(__deserializer,
__FieldVisitor)
}
}
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = Row;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"struct Row")
}
#[inline]
fn visit_seq<__A>(self, mut __seq: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::SeqAccess<'de> {
let __field0 =
match _serde::de::SeqAccess::next_element::<VersionId>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(0usize,
&"struct Row with 24 elements")),
};
let __field1 =
match _serde::de::SeqAccess::next_element::<CrateId>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(1usize,
&"struct Row with 24 elements")),
};
let __field2 =
match {
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Version,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: version(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
_serde::__private228::Option::map(_serde::de::SeqAccess::next_element::<__DeserializeWith<'de>>(&mut __seq)?,
|__wrap| __wrap.value)
} {
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(2usize,
&"struct Row with 24 elements")),
};
let __field3 =
match _serde::de::SeqAccess::next_element::<IgnoredStr>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field4 =
match {
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: DateTime<Utc>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: crate::datetime::de(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
_serde::__private228::Option::map(_serde::de::SeqAccess::next_element::<__DeserializeWith<'de>>(&mut __seq)?,
|__wrap| __wrap.value)
} {
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(4usize,
&"struct Row with 24 elements")),
};
let __field5 =
match {
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: DateTime<Utc>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: crate::datetime::de(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
_serde::__private228::Option::map(_serde::de::SeqAccess::next_element::<__DeserializeWith<'de>>(&mut __seq)?,
|__wrap| __wrap.value)
} {
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(5usize,
&"struct Row with 24 elements")),
};
let __field6 =
match _serde::de::SeqAccess::next_element::<u64>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(6usize,
&"struct Row with 24 elements")),
};
let __field7 =
match {
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Map<String, Vec<String>>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: features_map(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
_serde::__private228::Option::map(_serde::de::SeqAccess::next_element::<__DeserializeWith<'de>>(&mut __seq)?,
|__wrap| __wrap.value)
} {
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(7usize,
&"struct Row with 24 elements")),
};
let __field8 =
match {
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: bool,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: crate::bool::de(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
_serde::__private228::Option::map(_serde::de::SeqAccess::next_element::<__DeserializeWith<'de>>(&mut __seq)?,
|__wrap| __wrap.value)
} {
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(8usize,
&"struct Row with 24 elements")),
};
let __field9 =
match _serde::de::SeqAccess::next_element::<String>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(9usize,
&"struct Row with 24 elements")),
};
let __field10 =
match _serde::de::SeqAccess::next_element::<Option<u64>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(10usize,
&"struct Row with 24 elements")),
};
let __field11 =
match _serde::de::SeqAccess::next_element::<Option<UserId>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(11usize,
&"struct Row with 24 elements")),
};
let __field12 =
match {
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Option<[u8; 32]>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: checksum(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
_serde::__private228::Option::map(_serde::de::SeqAccess::next_element::<__DeserializeWith<'de>>(&mut __seq)?,
|__wrap| __wrap.value)
} {
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field13 =
match _serde::de::SeqAccess::next_element::<Option<String>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field14 =
match {
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Option<Version>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: rust_version(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
_serde::__private228::Option::map(_serde::de::SeqAccess::next_element::<__DeserializeWith<'de>>(&mut __seq)?,
|__wrap| __wrap.value)
} {
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field15 =
match {
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: bool,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: has_lib(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
_serde::__private228::Option::map(_serde::de::SeqAccess::next_element::<__DeserializeWith<'de>>(&mut __seq)?,
|__wrap| __wrap.value)
} {
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field16 =
match {
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Vec<String>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: bin_names(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
_serde::__private228::Option::map(_serde::de::SeqAccess::next_element::<__DeserializeWith<'de>>(&mut __seq)?,
|__wrap| __wrap.value)
} {
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field17 =
match _serde::de::SeqAccess::next_element::<Option<u16>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(17usize,
&"struct Row with 24 elements")),
};
let __field18 =
match _serde::de::SeqAccess::next_element::<Option<String>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(18usize,
&"struct Row with 24 elements")),
};
let __field19 =
match _serde::de::SeqAccess::next_element::<Option<String>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(19usize,
&"struct Row with 24 elements")),
};
let __field20 =
match _serde::de::SeqAccess::next_element::<Option<String>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(20usize,
&"struct Row with 24 elements")),
};
let __field21 =
match _serde::de::SeqAccess::next_element::<Option<String>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(21usize,
&"struct Row with 24 elements")),
};
let __field22 =
match {
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Vec<String>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: categories(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
_serde::__private228::Option::map(_serde::de::SeqAccess::next_element::<__DeserializeWith<'de>>(&mut __seq)?,
|__wrap| __wrap.value)
} {
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field23 =
match {
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Vec<String>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: keywords(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
_serde::__private228::Option::map(_serde::de::SeqAccess::next_element::<__DeserializeWith<'de>>(&mut __seq)?,
|__wrap| __wrap.value)
} {
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
_serde::__private228::Ok(Row {
id: __field0,
crate_id: __field1,
num: __field2,
num_no_build: __field3,
updated_at: __field4,
created_at: __field5,
downloads: __field6,
features: __field7,
yanked: __field8,
license: __field9,
crate_size: __field10,
published_by: __field11,
checksum: __field12,
links: __field13,
rust_version: __field14,
has_lib: __field15,
bin_names: __field16,
edition: __field17,
description: __field18,
homepage: __field19,
documentation: __field20,
repository: __field21,
categories: __field22,
keywords: __field23,
})
}
#[inline]
fn visit_map<__A>(self, mut __map: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::MapAccess<'de> {
let mut __field0: _serde::__private228::Option<VersionId> =
_serde::__private228::None;
let mut __field1: _serde::__private228::Option<CrateId> =
_serde::__private228::None;
let mut __field2: _serde::__private228::Option<Version> =
_serde::__private228::None;
let mut __field3: _serde::__private228::Option<IgnoredStr> =
_serde::__private228::None;
let mut __field4:
_serde::__private228::Option<DateTime<Utc>> =
_serde::__private228::None;
let mut __field5:
_serde::__private228::Option<DateTime<Utc>> =
_serde::__private228::None;
let mut __field6: _serde::__private228::Option<u64> =
_serde::__private228::None;
let mut __field7:
_serde::__private228::Option<Map<String, Vec<String>>> =
_serde::__private228::None;
let mut __field8: _serde::__private228::Option<bool> =
_serde::__private228::None;
let mut __field9: _serde::__private228::Option<String> =
_serde::__private228::None;
let mut __field10:
_serde::__private228::Option<Option<u64>> =
_serde::__private228::None;
let mut __field11:
_serde::__private228::Option<Option<UserId>> =
_serde::__private228::None;
let mut __field12:
_serde::__private228::Option<Option<[u8; 32]>> =
_serde::__private228::None;
let mut __field13:
_serde::__private228::Option<Option<String>> =
_serde::__private228::None;
let mut __field14:
_serde::__private228::Option<Option<Version>> =
_serde::__private228::None;
let mut __field15: _serde::__private228::Option<bool> =
_serde::__private228::None;
let mut __field16:
_serde::__private228::Option<Vec<String>> =
_serde::__private228::None;
let mut __field17:
_serde::__private228::Option<Option<u16>> =
_serde::__private228::None;
let mut __field18:
_serde::__private228::Option<Option<String>> =
_serde::__private228::None;
let mut __field19:
_serde::__private228::Option<Option<String>> =
_serde::__private228::None;
let mut __field20:
_serde::__private228::Option<Option<String>> =
_serde::__private228::None;
let mut __field21:
_serde::__private228::Option<Option<String>> =
_serde::__private228::None;
let mut __field22:
_serde::__private228::Option<Vec<String>> =
_serde::__private228::None;
let mut __field23:
_serde::__private228::Option<Vec<String>> =
_serde::__private228::None;
while let _serde::__private228::Some(__key) =
_serde::de::MapAccess::next_key::<__Field>(&mut __map)? {
match __key {
__Field::__field0 => {
if _serde::__private228::Option::is_some(&__field0) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("id"));
}
__field0 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<VersionId>(&mut __map)?);
}
__Field::__field1 => {
if _serde::__private228::Option::is_some(&__field1) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("crate_id"));
}
__field1 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<CrateId>(&mut __map)?);
}
__Field::__field2 => {
if _serde::__private228::Option::is_some(&__field2) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("num"));
}
__field2 =
_serde::__private228::Some({
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Version,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: version(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
match _serde::de::MapAccess::next_value::<__DeserializeWith<'de>>(&mut __map)
{
_serde::__private228::Ok(__wrapper) => __wrapper.value,
_serde::__private228::Err(__err) => {
return _serde::__private228::Err(__err);
}
}
});
}
__Field::__field3 => {
if _serde::__private228::Option::is_some(&__field3) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("num_no_build"));
}
__field3 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<IgnoredStr>(&mut __map)?);
}
__Field::__field4 => {
if _serde::__private228::Option::is_some(&__field4) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("updated_at"));
}
__field4 =
_serde::__private228::Some({
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: DateTime<Utc>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: crate::datetime::de(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
match _serde::de::MapAccess::next_value::<__DeserializeWith<'de>>(&mut __map)
{
_serde::__private228::Ok(__wrapper) => __wrapper.value,
_serde::__private228::Err(__err) => {
return _serde::__private228::Err(__err);
}
}
});
}
__Field::__field5 => {
if _serde::__private228::Option::is_some(&__field5) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("created_at"));
}
__field5 =
_serde::__private228::Some({
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: DateTime<Utc>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: crate::datetime::de(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
match _serde::de::MapAccess::next_value::<__DeserializeWith<'de>>(&mut __map)
{
_serde::__private228::Ok(__wrapper) => __wrapper.value,
_serde::__private228::Err(__err) => {
return _serde::__private228::Err(__err);
}
}
});
}
__Field::__field6 => {
if _serde::__private228::Option::is_some(&__field6) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("downloads"));
}
__field6 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<u64>(&mut __map)?);
}
__Field::__field7 => {
if _serde::__private228::Option::is_some(&__field7) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("features"));
}
__field7 =
_serde::__private228::Some({
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Map<String, Vec<String>>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: features_map(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
match _serde::de::MapAccess::next_value::<__DeserializeWith<'de>>(&mut __map)
{
_serde::__private228::Ok(__wrapper) => __wrapper.value,
_serde::__private228::Err(__err) => {
return _serde::__private228::Err(__err);
}
}
});
}
__Field::__field8 => {
if _serde::__private228::Option::is_some(&__field8) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("yanked"));
}
__field8 =
_serde::__private228::Some({
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: bool,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: crate::bool::de(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
match _serde::de::MapAccess::next_value::<__DeserializeWith<'de>>(&mut __map)
{
_serde::__private228::Ok(__wrapper) => __wrapper.value,
_serde::__private228::Err(__err) => {
return _serde::__private228::Err(__err);
}
}
});
}
__Field::__field9 => {
if _serde::__private228::Option::is_some(&__field9) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("license"));
}
__field9 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<String>(&mut __map)?);
}
__Field::__field10 => {
if _serde::__private228::Option::is_some(&__field10) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("crate_size"));
}
__field10 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Option<u64>>(&mut __map)?);
}
__Field::__field11 => {
if _serde::__private228::Option::is_some(&__field11) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("published_by"));
}
__field11 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Option<UserId>>(&mut __map)?);
}
__Field::__field12 => {
if _serde::__private228::Option::is_some(&__field12) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("checksum"));
}
__field12 =
_serde::__private228::Some({
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Option<[u8; 32]>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: checksum(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
match _serde::de::MapAccess::next_value::<__DeserializeWith<'de>>(&mut __map)
{
_serde::__private228::Ok(__wrapper) => __wrapper.value,
_serde::__private228::Err(__err) => {
return _serde::__private228::Err(__err);
}
}
});
}
__Field::__field13 => {
if _serde::__private228::Option::is_some(&__field13) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("links"));
}
__field13 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Option<String>>(&mut __map)?);
}
__Field::__field14 => {
if _serde::__private228::Option::is_some(&__field14) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("rust_version"));
}
__field14 =
_serde::__private228::Some({
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Option<Version>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: rust_version(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
match _serde::de::MapAccess::next_value::<__DeserializeWith<'de>>(&mut __map)
{
_serde::__private228::Ok(__wrapper) => __wrapper.value,
_serde::__private228::Err(__err) => {
return _serde::__private228::Err(__err);
}
}
});
}
__Field::__field15 => {
if _serde::__private228::Option::is_some(&__field15) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("has_lib"));
}
__field15 =
_serde::__private228::Some({
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: bool,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: has_lib(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
match _serde::de::MapAccess::next_value::<__DeserializeWith<'de>>(&mut __map)
{
_serde::__private228::Ok(__wrapper) => __wrapper.value,
_serde::__private228::Err(__err) => {
return _serde::__private228::Err(__err);
}
}
});
}
__Field::__field16 => {
if _serde::__private228::Option::is_some(&__field16) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("bin_names"));
}
__field16 =
_serde::__private228::Some({
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Vec<String>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: bin_names(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
match _serde::de::MapAccess::next_value::<__DeserializeWith<'de>>(&mut __map)
{
_serde::__private228::Ok(__wrapper) => __wrapper.value,
_serde::__private228::Err(__err) => {
return _serde::__private228::Err(__err);
}
}
});
}
__Field::__field17 => {
if _serde::__private228::Option::is_some(&__field17) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("edition"));
}
__field17 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Option<u16>>(&mut __map)?);
}
__Field::__field18 => {
if _serde::__private228::Option::is_some(&__field18) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("description"));
}
__field18 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Option<String>>(&mut __map)?);
}
__Field::__field19 => {
if _serde::__private228::Option::is_some(&__field19) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("homepage"));
}
__field19 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Option<String>>(&mut __map)?);
}
__Field::__field20 => {
if _serde::__private228::Option::is_some(&__field20) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("documentation"));
}
__field20 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Option<String>>(&mut __map)?);
}
__Field::__field21 => {
if _serde::__private228::Option::is_some(&__field21) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("repository"));
}
__field21 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Option<String>>(&mut __map)?);
}
__Field::__field22 => {
if _serde::__private228::Option::is_some(&__field22) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("categories"));
}
__field22 =
_serde::__private228::Some({
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Vec<String>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: categories(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
match _serde::de::MapAccess::next_value::<__DeserializeWith<'de>>(&mut __map)
{
_serde::__private228::Ok(__wrapper) => __wrapper.value,
_serde::__private228::Err(__err) => {
return _serde::__private228::Err(__err);
}
}
});
}
__Field::__field23 => {
if _serde::__private228::Option::is_some(&__field23) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("keywords"));
}
__field23 =
_serde::__private228::Some({
#[doc(hidden)]
struct __DeserializeWith<'de> {
value: Vec<String>,
phantom: _serde::__private228::PhantomData<Row>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for
__DeserializeWith<'de> {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Ok(__DeserializeWith {
value: keywords(__deserializer)?,
phantom: _serde::__private228::PhantomData,
lifetime: _serde::__private228::PhantomData,
})
}
}
match _serde::de::MapAccess::next_value::<__DeserializeWith<'de>>(&mut __map)
{
_serde::__private228::Ok(__wrapper) => __wrapper.value,
_serde::__private228::Err(__err) => {
return _serde::__private228::Err(__err);
}
}
});
}
}
}
let __field0 =
match __field0 {
_serde::__private228::Some(__field0) => __field0,
_serde::__private228::None =>
_serde::__private228::de::missing_field("id")?,
};
let __field1 =
match __field1 {
_serde::__private228::Some(__field1) => __field1,
_serde::__private228::None =>
_serde::__private228::de::missing_field("crate_id")?,
};
let __field2 =
match __field2 {
_serde::__private228::Some(__field2) => __field2,
_serde::__private228::None =>
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::missing_field("num")),
};
let __field3 =
match __field3 {
_serde::__private228::Some(__field3) => __field3,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field4 =
match __field4 {
_serde::__private228::Some(__field4) => __field4,
_serde::__private228::None =>
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::missing_field("updated_at")),
};
let __field5 =
match __field5 {
_serde::__private228::Some(__field5) => __field5,
_serde::__private228::None =>
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::missing_field("created_at")),
};
let __field6 =
match __field6 {
_serde::__private228::Some(__field6) => __field6,
_serde::__private228::None =>
_serde::__private228::de::missing_field("downloads")?,
};
let __field7 =
match __field7 {
_serde::__private228::Some(__field7) => __field7,
_serde::__private228::None =>
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::missing_field("features")),
};
let __field8 =
match __field8 {
_serde::__private228::Some(__field8) => __field8,
_serde::__private228::None =>
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::missing_field("yanked")),
};
let __field9 =
match __field9 {
_serde::__private228::Some(__field9) => __field9,
_serde::__private228::None =>
_serde::__private228::de::missing_field("license")?,
};
let __field10 =
match __field10 {
_serde::__private228::Some(__field10) => __field10,
_serde::__private228::None =>
_serde::__private228::de::missing_field("crate_size")?,
};
let __field11 =
match __field11 {
_serde::__private228::Some(__field11) => __field11,
_serde::__private228::None =>
_serde::__private228::de::missing_field("published_by")?,
};
let __field12 =
match __field12 {
_serde::__private228::Some(__field12) => __field12,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field13 =
match __field13 {
_serde::__private228::Some(__field13) => __field13,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field14 =
match __field14 {
_serde::__private228::Some(__field14) => __field14,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field15 =
match __field15 {
_serde::__private228::Some(__field15) => __field15,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field16 =
match __field16 {
_serde::__private228::Some(__field16) => __field16,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field17 =
match __field17 {
_serde::__private228::Some(__field17) => __field17,
_serde::__private228::None =>
_serde::__private228::de::missing_field("edition")?,
};
let __field18 =
match __field18 {
_serde::__private228::Some(__field18) => __field18,
_serde::__private228::None =>
_serde::__private228::de::missing_field("description")?,
};
let __field19 =
match __field19 {
_serde::__private228::Some(__field19) => __field19,
_serde::__private228::None =>
_serde::__private228::de::missing_field("homepage")?,
};
let __field20 =
match __field20 {
_serde::__private228::Some(__field20) => __field20,
_serde::__private228::None =>
_serde::__private228::de::missing_field("documentation")?,
};
let __field21 =
match __field21 {
_serde::__private228::Some(__field21) => __field21,
_serde::__private228::None =>
_serde::__private228::de::missing_field("repository")?,
};
let __field22 =
match __field22 {
_serde::__private228::Some(__field22) => __field22,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
let __field23 =
match __field23 {
_serde::__private228::Some(__field23) => __field23,
_serde::__private228::None =>
_serde::__private228::Default::default(),
};
_serde::__private228::Ok(Row {
id: __field0,
crate_id: __field1,
num: __field2,
num_no_build: __field3,
updated_at: __field4,
created_at: __field5,
downloads: __field6,
features: __field7,
yanked: __field8,
license: __field9,
crate_size: __field10,
published_by: __field11,
checksum: __field12,
links: __field13,
rust_version: __field14,
has_lib: __field15,
bin_names: __field16,
edition: __field17,
description: __field18,
homepage: __field19,
documentation: __field20,
repository: __field21,
categories: __field22,
keywords: __field23,
})
}
}
#[doc(hidden)]
const FIELDS: &'static [&'static str] =
&["id", "crate_id", "num", "num_no_build", "updated_at",
"created_at", "downloads", "features", "yanked", "license",
"crate_size", "published_by", "checksum", "links",
"rust_version", "has_lib", "bin_names", "edition",
"description", "homepage", "documentation", "repository",
"categories", "keywords"];
_serde::Deserializer::deserialize_struct(__deserializer,
"Row", FIELDS,
__Visitor {
marker: _serde::__private228::PhantomData::<Row>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};Deserialize)]
59 #[serde(deny_unknown_fields)]
60 struct Row {
61 id: VersionId,
62 crate_id: CrateId,
63 #[serde(deserialize_with = "version")]
64 num: Version,
65 #[serde(default)]
66 #[allow(dead_code)]
67 num_no_build: IgnoredStr,
68 #[serde(deserialize_with = "crate::datetime::de")]
69 updated_at: DateTime<Utc>,
70 #[serde(deserialize_with = "crate::datetime::de")]
71 created_at: DateTime<Utc>,
72 downloads: u64,
73 #[serde(deserialize_with = "features_map")]
74 features: Map<String, Vec<String>>,
75 #[serde(deserialize_with = "crate::bool::de")]
76 yanked: bool,
77 license: String,
78 crate_size: Option<u64>,
79 published_by: Option<UserId>,
80 #[serde(deserialize_with = "checksum", default)]
81 checksum: Option<[u8; 32]>,
82 #[serde(default)]
83 links: Option<String>,
84 #[serde(default, deserialize_with = "rust_version")]
85 rust_version: Option<Version>,
86 #[serde(default, deserialize_with = "has_lib")]
87 has_lib: bool,
88 #[serde(default, deserialize_with = "bin_names")]
89 bin_names: Vec<String>,
90 edition: Option<u16>,
91 description: Option<String>,
92 homepage: Option<String>,
93 documentation: Option<String>,
94 repository: Option<String>,
95 #[serde(default, deserialize_with = "categories")]
96 categories: Vec<String>,
97 #[serde(default, deserialize_with = "keywords")]
98 keywords: Vec<String>,
99 }
100
101 let Row {
102 id,
103 crate_id,
104 num,
105 num_no_build: _,
106 updated_at,
107 created_at,
108 downloads,
109 features,
110 yanked,
111 license,
112 crate_size,
113 published_by,
114 checksum,
115 links,
116 rust_version,
117 has_lib,
118 bin_names,
119 edition,
120 description,
121 homepage,
122 documentation,
123 repository,
124 categories,
125 keywords,
126 } = Row::deserialize(deserializer)?;
127 Ok(Self {
128 id,
129 crate_id,
130 num,
131 updated_at,
132 created_at,
133 downloads,
134 features,
135 yanked,
136 license,
137 crate_size,
138 published_by,
139 checksum,
140 links,
141 rust_version,
142 has_lib,
143 bin_names,
144 edition,
145 description,
146 homepage,
147 documentation,
148 repository,
149 categories,
150 keywords,
151 })
152 }
153}
154
155impl Ord for Row {
156 fn cmp(&self, other: &Self) -> Ordering {
157 VersionId::cmp(&self.id, &other.id)
158 }
159}
160
161impl PartialOrd for Row {
162 fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
163 Some(self.cmp(other))
164 }
165}
166
167impl Eq for Row {}
168
169impl PartialEq for Row {
170 fn eq(&self, other: &Self) -> bool {
171 VersionId::eq(&self.id, &other.id)
172 }
173}
174
175impl Hash for Row {
176 fn hash<H: Hasher>(&self, state: &mut H) {
177 VersionId::hash(&self.id, state);
178 }
179}
180
181impl Borrow<VersionId> for Row {
182 fn borrow(&self) -> &VersionId {
183 &self.id
184 }
185}
186
187fn compat(string: &str) -> Option<Version> {
188 let deprecated = match string {
189 "0.0.1-001" => "0.0.1-1",
190 "0.3.0-alpha.01" => "0.3.0-alpha.1",
191 "0.4.0-alpha.00" => "0.4.0-alpha.0",
192 "0.4.0-alpha.01" => "0.4.0-alpha.1",
193 _ => return None,
194 };
195 Some(deprecated.parse().unwrap())
196}
197
198struct VersionVisitor;
199
200impl<'de> Visitor<'de> for VersionVisitor {
201 type Value = Version;
202
203 fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
204 formatter.write_str("semver version")
205 }
206
207 fn visit_str<E>(self, string: &str) -> Result<Self::Value, E>
208 where
209 E: serde::de::Error,
210 {
211 match string.parse() {
212 Ok(version) => Ok(version),
213 Err(err) => {
214 if let Some(version) = compat(string) {
215 Ok(version)
216 } else {
217 Err(serde::de::Error::custom(format_args!("{0}: {1}", err, string)format_args!(
218 "{}: {}",
219 err, string,
220 )))
221 }
222 }
223 }
224 }
225}
226
227fn version<'de, D>(deserializer: D) -> Result<Version, D::Error>
228where
229 D: Deserializer<'de>,
230{
231 deserializer.deserialize_str(VersionVisitor)
232}
233
234struct FeaturesMapVisitor;
235
236impl<'de> Visitor<'de> for FeaturesMapVisitor {
237 type Value = Map<String, Vec<String>>;
238
239 fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
240 formatter.write_str("features map")
241 }
242
243 fn visit_str<E>(self, string: &str) -> Result<Self::Value, E>
244 where
245 E: serde::de::Error,
246 {
247 serde_json::from_str(string).map_err(serde::de::Error::custom)
248 }
249}
250
251fn features_map<'de, D>(deserializer: D) -> Result<Map<String, Vec<String>>, D::Error>
252where
253 D: Deserializer<'de>,
254{
255 deserializer.deserialize_str(FeaturesMapVisitor)
256}
257
258struct ChecksumVisitor;
259
260impl<'de> Visitor<'de> for ChecksumVisitor {
261 type Value = Option<[u8; 32]>;
262
263 fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
264 formatter.write_str("checksum as 64-character hex string")
265 }
266
267 fn visit_str<E>(self, string: &str) -> Result<Self::Value, E>
268 where
269 E: serde::de::Error,
270 {
271 match string.len() {
272 0 => Ok(None),
273 64 => {
274 let mut checksum = [0u8; 32];
275 for i in 0..32 {
276 match u8::from_str_radix(&string[i * 2..][..2], 16) {
277 Ok(byte) => checksum[i] = byte,
278 Err(_) => return Err(E::invalid_value(Unexpected::Str(string), &self)),
279 }
280 }
281 Ok(Some(checksum))
282 }
283 _ => Err(E::invalid_value(Unexpected::Str(string), &self)),
284 }
285 }
286}
287
288fn checksum<'de, D>(deserializer: D) -> Result<Option<[u8; 32]>, D::Error>
289where
290 D: Deserializer<'de>,
291{
292 deserializer.deserialize_str(ChecksumVisitor)
293}
294
295struct RustVersionVisitor;
296
297impl<'de> Visitor<'de> for RustVersionVisitor {
298 type Value = Option<Version>;
299
300 fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
301 formatter.write_str("a compiler version number")
302 }
303
304 fn visit_str<E>(self, string: &str) -> Result<Self::Value, E>
305 where
306 E: serde::de::Error,
307 {
308 match VersionReq::from_str(string) {
309 Ok(mut req) if req.comparators.len() == 1 => {
310 let req = req.comparators.pop().unwrap();
311 if req.op == Op::Caret {
312 Ok(Some(Version {
313 major: req.major,
314 minor: req.minor.unwrap_or(0),
315 patch: req.patch.unwrap_or(0),
316 pre: req.pre,
317 build: BuildMetadata::EMPTY,
318 }))
319 } else {
320 Ok(None)
321 }
322 }
323 Ok(_) => Ok(None),
324 Err(parse_error) => Err(E::custom(parse_error)),
325 }
326 }
327
328 fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
329 where
330 D: Deserializer<'de>,
331 {
332 deserializer.deserialize_str(self)
333 }
334
335 fn visit_none<E>(self) -> Result<Self::Value, E>
336 where
337 E: serde::de::Error,
338 {
339 Ok(None)
340 }
341}
342
343fn rust_version<'de, D>(deserializer: D) -> Result<Option<Version>, D::Error>
344where
345 D: Deserializer<'de>,
346{
347 deserializer.deserialize_option(RustVersionVisitor)
348}
349
350#[derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for HasLib {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::__private228::Result::map(crate::bool::de(__deserializer),
|__transparent| HasLib { 0: __transparent })
}
}
};Deserialize)]
351#[serde(transparent)]
352struct HasLib(#[serde(deserialize_with = "crate::bool::de")] bool);
353
354fn has_lib<'de, D>(deserializer: D) -> Result<bool, D::Error>
355where
356 D: Deserializer<'de>,
357{
358 match Deserialize::deserialize(deserializer)? {
359 Some(HasLib(has_lib)) => Ok(has_lib),
360 None => Ok(false),
361 }
362}
363
364fn bin_names<'de, D>(deserializer: D) -> Result<Vec<String>, D::Error>
365where
366 D: Deserializer<'de>,
367{
368 crate::set::optional(deserializer, "binary names set")
369}
370
371fn categories<'de, D>(deserializer: D) -> Result<Vec<String>, D::Error>
372where
373 D: Deserializer<'de>,
374{
375 crate::set::de(deserializer, "categories set")
376}
377
378fn keywords<'de, D>(deserializer: D) -> Result<Vec<String>, D::Error>
379where
380 D: Deserializer<'de>,
381{
382 crate::set::de(deserializer, "keywords set")
383}