compose_utils/
lib.rs

1mod trace;
2
3use std::hash::Hash;
4use std::ops::Deref;
5
6pub use trace::*;
7
8#[derive(Debug)]
9pub struct Static<T: 'static>(pub &'static T);
10
11impl<T> Deref for Static<T> {
12    type Target = T;
13
14    fn deref(&self) -> &Self::Target {
15        self.0
16    }
17}
18
19impl<T> Copy for Static<T> {}
20
21impl<T> Clone for Static<T> {
22    fn clone(&self) -> Self {
23        *self
24    }
25}
26
27impl<T> Eq for Static<T> {}
28
29impl<T> PartialEq for Static<T> {
30    fn eq(&self, other: &Self) -> bool {
31        std::ptr::eq(self.0, other.0)
32    }
33}
34
35impl<T> Hash for Static<T> {
36    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
37        state.write_usize(std::ptr::from_ref(self.0) as _);
38    }
39}