1use core::fmt;
4use core::hash::{Hash, Hasher};
5use core::marker::PhantomData;
6
7#[derive(Clone, Copy)]
9pub struct Tag<K: ?Sized>(PhantomData<fn() -> *const K>);
10
11impl<K: ?Sized> fmt::Debug for Tag<K> {
12 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13 f.write_str("Tag")
14 }
15}
16
17impl<K: ?Sized> Tag<K> {
18 pub const fn new() -> Self {
20 Self(PhantomData)
21 }
22}
23
24impl<K: ?Sized> Default for Tag<K> {
25 fn default() -> Self {
26 Self::new()
27 }
28}
29
30impl<K: ?Sized> PartialEq for Tag<K> {
31 fn eq(&self, _other: &Self) -> bool {
32 true
33 }
34}
35
36impl<K: ?Sized> Eq for Tag<K> {}
37
38impl<K: ?Sized> Hash for Tag<K> {
39 fn hash<H: Hasher>(&self, state: &mut H) {
40 state.write_u8(0);
41 }
42}