Skip to content

Commit edd9a5a

Browse files
committed
Add Hash implementation to Type
1 parent a22f63b commit edd9a5a

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

codegen/src/type_gen.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ use std::sync::Arc;
266266
267267
use crate::{{Type, Oid, Kind}};
268268
269-
#[derive(PartialEq, Eq, Debug)]
269+
#[derive(PartialEq, Eq, Debug, Hash)]
270270
pub struct Other {{
271271
pub name: String,
272272
pub oid: Oid,
@@ -282,7 +282,7 @@ fn make_enum(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
282282
write!(
283283
w,
284284
"
285-
#[derive(PartialEq, Eq, Clone, Debug)]
285+
#[derive(PartialEq, Eq, Clone, Debug, Hash)]
286286
pub enum Inner {{"
287287
)
288288
.unwrap();

postgres-types/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ mod special;
209209
mod type_gen;
210210

211211
/// A Postgres type.
212-
#[derive(PartialEq, Eq, Clone, Debug)]
212+
#[derive(PartialEq, Eq, Clone, Debug, Hash)]
213213
pub struct Type(Inner);
214214

215215
impl fmt::Display for Type {
@@ -264,7 +264,7 @@ impl Type {
264264
}
265265

266266
/// Represents the kind of a Postgres type.
267-
#[derive(Debug, Clone, PartialEq, Eq)]
267+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
268268
pub enum Kind {
269269
/// A simple type like `VARCHAR` or `INTEGER`.
270270
Simple,
@@ -285,7 +285,7 @@ pub enum Kind {
285285
}
286286

287287
/// Information about a field of a composite type.
288-
#[derive(Debug, Clone, PartialEq, Eq)]
288+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
289289
pub struct Field {
290290
name: String,
291291
type_: Type,

postgres-types/src/type_gen.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ use std::sync::Arc;
33

44
use crate::{Kind, Oid, Type};
55

6-
#[derive(PartialEq, Eq, Debug)]
6+
#[derive(PartialEq, Eq, Debug, Hash)]
77
pub struct Other {
88
pub name: String,
99
pub oid: Oid,
1010
pub kind: Kind,
1111
pub schema: String,
1212
}
1313

14-
#[derive(PartialEq, Eq, Clone, Debug)]
14+
#[derive(PartialEq, Eq, Clone, Debug, Hash)]
1515
pub enum Inner {
1616
Bool,
1717
Bytea,

0 commit comments

Comments
 (0)