rune_core/hash/
into_hash.rs1use crate::hash::Hash;
2use crate::protocol::Protocol;
3
4mod sealed {
5 use crate::hash::Hash;
6 use crate::params::Params;
7 use crate::protocol::Protocol;
8
9 pub trait Sealed {}
10
11 impl Sealed for &str {}
12 impl Sealed for Hash {}
13 impl Sealed for &Protocol {}
14 impl<T, const N: usize> Sealed for Params<T, N> {}
15}
16
17pub trait IntoHash: self::sealed::Sealed {
21 fn into_hash(self) -> Hash;
23}
24
25impl IntoHash for Hash {
26 #[inline]
27 fn into_hash(self) -> Hash {
28 self
29 }
30}
31
32impl IntoHash for &str {
33 #[inline]
34 fn into_hash(self) -> Hash {
35 Hash::ident(self)
36 }
37}
38
39impl IntoHash for &Protocol {
40 #[inline]
41 fn into_hash(self) -> Hash {
42 self.hash
43 }
44}