1use std::{fmt, hash};
2
3use super::Atom;
4
5impl<'a, T: ?Sized> Copy for Atom<'a, T> {}
6impl<'a, T: ?Sized> Clone for Atom<'a, T> {
7 fn clone(&self) -> Self {
8 *self
9 }
10}
11
12impl<'a, T: ?Sized + fmt::Debug> fmt::Debug for Atom<'a, T> {
13 fn fmt(&self, x: &mut fmt::Formatter) -> fmt::Result {
14 self.__ptr.fmt(x)
15 }
16}
17impl<'a, T: ?Sized + fmt::Display> fmt::Display for Atom<'a, T> {
18 fn fmt(&self, x: &mut fmt::Formatter) -> fmt::Result {
19 self.__ptr.fmt(x)
20 }
21}
22
23impl<'a, T: ?Sized> hash::Hash for Atom<'a, T> {
24 fn hash<H: hash::Hasher>(&self, h: &mut H) {
25 (self.__ptr as *const T).hash(h)
26 }
27}
28
29impl<'a, T: 'a + ?Sized> std::ops::Deref for Atom<'a, T> {
30 type Target = T;
31
32 fn deref(&self) -> &T {
33 self.__ptr
34 }
35}
36
37impl<'a, T: 'a + ?Sized> PartialEq for Atom<'a, T> {
38 fn eq(&self, other: &Self) -> bool {
39 (self.__ptr as *const _) == (other.__ptr as *const _)
40 }
41}
42impl<'a, T: 'a + ?Sized> Eq for Atom<'a, T> {}