1use serde_derive::{Deserialize, Serialize};
4use std::borrow::Borrow;
5use std::cmp::Ordering;
6use std::hash::{Hash, Hasher};
7
8#[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 UserId {
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 UserId {
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| UserId { 0: __transparent })
}
}
};Deserialize, #[automatically_derived]
impl ::core::marker::Copy for UserId { }Copy, #[automatically_derived]
impl ::core::clone::Clone for UserId {
#[inline]
fn clone(&self) -> UserId {
let _: ::core::clone::AssertParamIsClone<u32>;
*self
}
}Clone, #[automatically_derived]
impl ::core::cmp::Ord for UserId {
#[inline]
fn cmp(&self, other: &UserId) -> ::core::cmp::Ordering {
::core::cmp::Ord::cmp(&self.0, &other.0)
}
}Ord, #[automatically_derived]
impl ::core::cmp::PartialOrd for UserId {
#[inline]
fn partial_cmp(&self, other: &UserId)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0)
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for UserId {
#[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 UserId {
#[inline]
fn eq(&self, other: &UserId) -> bool { self.0 == other.0 }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for UserId {
#[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 UserId {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_tuple_field1_finish(f, "UserId",
&&self.0)
}
}Debug)]
10#[serde(transparent)]
11#[cfg_attr(not(doc), repr(transparent))]
12pub struct UserId(pub u32);
13
14#[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,
}
#[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),
_ =>
_serde::__private228::Err(_serde::de::Error::invalid_value(_serde::de::Unexpected::Unsigned(__value),
&"field index 0 <= i < 5")),
}
}
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),
"gh_login" => _serde::__private228::Ok(__Field::__field1),
"name" => _serde::__private228::Ok(__Field::__field2),
"gh_avatar" => _serde::__private228::Ok(__Field::__field3),
"gh_id" => _serde::__private228::Ok(__Field::__field4),
_ => {
_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"gh_login" => _serde::__private228::Ok(__Field::__field1),
b"name" => _serde::__private228::Ok(__Field::__field2),
b"gh_avatar" => _serde::__private228::Ok(__Field::__field3),
b"gh_id" => _serde::__private228::Ok(__Field::__field4),
_ => {
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::<UserId>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(0usize,
&"struct Row with 5 elements")),
};
let __field1 =
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(1usize,
&"struct Row with 5 elements")),
};
let __field2 =
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(2usize,
&"struct Row with 5 elements")),
};
let __field3 =
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(3usize,
&"struct Row with 5 elements")),
};
let __field4 =
match _serde::de::SeqAccess::next_element::<i32>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(4usize,
&"struct Row with 5 elements")),
};
_serde::__private228::Ok(Row {
id: __field0,
gh_login: __field1,
name: __field2,
gh_avatar: __field3,
gh_id: __field4,
})
}
#[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<UserId> =
_serde::__private228::None;
let mut __field1: _serde::__private228::Option<String> =
_serde::__private228::None;
let mut __field2:
_serde::__private228::Option<Option<String>> =
_serde::__private228::None;
let mut __field3: _serde::__private228::Option<String> =
_serde::__private228::None;
let mut __field4: _serde::__private228::Option<i32> =
_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::<UserId>(&mut __map)?);
}
__Field::__field1 => {
if _serde::__private228::Option::is_some(&__field1) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("gh_login"));
}
__field1 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<String>(&mut __map)?);
}
__Field::__field2 => {
if _serde::__private228::Option::is_some(&__field2) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("name"));
}
__field2 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Option<String>>(&mut __map)?);
}
__Field::__field3 => {
if _serde::__private228::Option::is_some(&__field3) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("gh_avatar"));
}
__field3 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<String>(&mut __map)?);
}
__Field::__field4 => {
if _serde::__private228::Option::is_some(&__field4) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("gh_id"));
}
__field4 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<i32>(&mut __map)?);
}
}
}
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("gh_login")?,
};
let __field2 =
match __field2 {
_serde::__private228::Some(__field2) => __field2,
_serde::__private228::None =>
_serde::__private228::de::missing_field("name")?,
};
let __field3 =
match __field3 {
_serde::__private228::Some(__field3) => __field3,
_serde::__private228::None =>
_serde::__private228::de::missing_field("gh_avatar")?,
};
let __field4 =
match __field4 {
_serde::__private228::Some(__field4) => __field4,
_serde::__private228::None =>
_serde::__private228::de::missing_field("gh_id")?,
};
_serde::__private228::Ok(Row {
id: __field0,
gh_login: __field1,
name: __field2,
gh_avatar: __field3,
gh_id: __field4,
})
}
}
#[doc(hidden)]
const FIELDS: &'static [&'static str] =
&["id", "gh_login", "name", "gh_avatar", "gh_id"];
_serde::Deserializer::deserialize_struct(__deserializer,
"Row", FIELDS,
__Visitor {
marker: _serde::__private228::PhantomData::<Row>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};Deserialize, #[automatically_derived]
impl ::core::clone::Clone for Row {
#[inline]
fn clone(&self) -> Row {
Row {
id: ::core::clone::Clone::clone(&self.id),
gh_login: ::core::clone::Clone::clone(&self.gh_login),
name: ::core::clone::Clone::clone(&self.name),
gh_avatar: ::core::clone::Clone::clone(&self.gh_avatar),
gh_id: ::core::clone::Clone::clone(&self.gh_id),
}
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Row {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "Row", "id",
&self.id, "gh_login", &self.gh_login, "name", &self.name,
"gh_avatar", &self.gh_avatar, "gh_id", &&self.gh_id)
}
}Debug)]
16#[serde(deny_unknown_fields)]
17#[non_exhaustive]
18pub struct Row {
19 pub id: UserId,
21 pub gh_login: String,
22 pub name: Option<String>,
23 pub gh_avatar: String,
24 pub gh_id: i32,
25}
26
27impl Ord for Row {
28 fn cmp(&self, other: &Self) -> Ordering {
29 UserId::cmp(&self.id, &other.id)
30 }
31}
32
33impl PartialOrd for Row {
34 fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
35 Some(self.cmp(other))
36 }
37}
38
39impl Eq for Row {}
40
41impl PartialEq for Row {
42 fn eq(&self, other: &Self) -> bool {
43 UserId::eq(&self.id, &other.id)
44 }
45}
46
47impl Hash for Row {
48 fn hash<H: Hasher>(&self, state: &mut H) {
49 UserId::hash(&self.id, state);
50 }
51}
52
53impl Borrow<UserId> for Row {
54 fn borrow(&self) -> &UserId {
55 &self.id
56 }
57}