use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use uuid::Uuid;

pub struct JsType {
    uid: Uuid,
    thing: Box<JsThing>,
}

impl JsType {
    fn new(thing: Box<JsThing>) -> JsType {
        JsType {
            uid: Uuid::new_v4(),
            thing: thing,
        }
    }
}

impl PartialEq for JsType {
    fn eq(&self, other: &Self) -> bool {
        self.uid == other.uid
    }

    fn ne(&self, other: &Self) -> bool {
        !self.eq(other)
    }
}

impl Eq for JsType{}

impl Hash for JsType {
    fn hash<H>(&self, state: &mut H) where H: Hasher {
        self.uid.hash(state);
    }

    fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher {
        for ref d in data {
            d.uid.hash(state);
        }
    }
}

pub trait JsThing {}

use std::cmp::Ordering;

pub struct JsType {
    uid: u64,
    thing: Box<JsThing>,
}

impl PartialEq for JsType {
    fn eq(&self, other: &Self) -> bool {
        self.uid == other.uid
    }

    fn ne(&self, other: &Self) -> bool {
        !self.eq(other)
    }
}

impl Eq for JsType{}

impl PartialOrd for JsType {
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        Some(self.uid.cmp(&other.uid))
    }
}

impl Ord for JsType {
    fn cmp(&self, other: &Self) -> Ordering {
        self.uid.cmp(&other.uid)
    }
}

pub trait JsThing {}

--- 
+++ 
@@ -1,8 +1,19 @@
 use std::cmp::Ordering;
+use std::hash::{Hash, Hasher};
+use uuid::Uuid;
 
 pub struct JsType {
-    uid: u64,
+    uid: Uuid,
     thing: Box<JsThing>,
+}
+
+impl JsType {
+    fn new(thing: Box<JsThing>) -> JsType {
+        JsType {
+            uid: Uuid::new_v4(),
+            thing: thing,
+        }
+    }
 }
 
 impl PartialEq for JsType {
@@ -17,15 +28,15 @@
 
 impl Eq for JsType{}
 
-impl PartialOrd for JsType {
-    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
-        Some(self.uid.cmp(&other.uid))
+impl Hash for JsType {
+    fn hash<H>(&self, state: &mut H) where H: Hasher {
+        self.uid.hash(state);
     }
-}
 
-impl Ord for JsType {
-    fn cmp(&self, other: &Self) -> Ordering {
-        self.uid.cmp(&other.uid)
+    fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher {
+        for ref d in data {
+            d.uid.hash(state);
+        }
     }
 }
 
Make JsType Hash instead of Ord
