Add Hash implementation to Type

This commit is contained in:
Michael P. Jung 2019-11-18 15:57:09 +01:00
parent a22f63b5bb
commit edd9a5aa7f
3 changed files with 7 additions and 7 deletions

View File

@ -266,7 +266,7 @@ use std::sync::Arc;
use crate::{{Type, Oid, Kind}}; use crate::{{Type, Oid, Kind}};
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug, Hash)]
pub struct Other {{ pub struct Other {{
pub name: String, pub name: String,
pub oid: Oid, pub oid: Oid,
@ -282,7 +282,7 @@ fn make_enum(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
write!( write!(
w, w,
" "
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(PartialEq, Eq, Clone, Debug, Hash)]
pub enum Inner {{" pub enum Inner {{"
) )
.unwrap(); .unwrap();

View File

@ -209,7 +209,7 @@ mod special;
mod type_gen; mod type_gen;
/// A Postgres type. /// A Postgres type.
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(PartialEq, Eq, Clone, Debug, Hash)]
pub struct Type(Inner); pub struct Type(Inner);
impl fmt::Display for Type { impl fmt::Display for Type {
@ -264,7 +264,7 @@ impl Type {
} }
/// Represents the kind of a Postgres type. /// Represents the kind of a Postgres type.
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Kind { pub enum Kind {
/// A simple type like `VARCHAR` or `INTEGER`. /// A simple type like `VARCHAR` or `INTEGER`.
Simple, Simple,
@ -285,7 +285,7 @@ pub enum Kind {
} }
/// Information about a field of a composite type. /// Information about a field of a composite type.
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Field { pub struct Field {
name: String, name: String,
type_: Type, type_: Type,

View File

@ -3,7 +3,7 @@ use std::sync::Arc;
use crate::{Kind, Oid, Type}; use crate::{Kind, Oid, Type};
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug, Hash)]
pub struct Other { pub struct Other {
pub name: String, pub name: String,
pub oid: Oid, pub oid: Oid,
@ -11,7 +11,7 @@ pub struct Other {
pub schema: String, pub schema: String,
} }
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(PartialEq, Eq, Clone, Debug, Hash)]
pub enum Inner { pub enum Inner {
Bool, Bool,
Bytea, Bytea,