use serde_derive::{Deserialize, Serialize};
use std::borrow::Borrow;
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
#[derive(Serialize, Deserialize, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]
#[serde(transparent)]
#[cfg_attr(not(doc), repr(transparent))]
pub struct UserId(pub u32);
#[derive(Deserialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Row {
pub id: UserId,
pub gh_login: String,
pub name: Option<String>,
pub gh_avatar: String,
pub gh_id: i32,
}
impl Ord for Row {
fn cmp(&self, other: &Self) -> Ordering {
UserId::cmp(&self.id, &other.id)
}
}
impl PartialOrd for Row {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Eq for Row {}
impl PartialEq for Row {
fn eq(&self, other: &Self) -> bool {
UserId::eq(&self.id, &other.id)
}
}
impl Hash for Row {
fn hash<H: Hasher>(&self, state: &mut H) {
UserId::hash(&self.id, state);
}
}
impl Borrow<UserId> for Row {
fn borrow(&self) -> &UserId {
&self.id
}
}