rune_core/hash/
into_hash.rs
1use 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 {
20 fn into_hash(self) -> Hash;
22}
23
24impl IntoHash for Hash {
25 #[inline]
26 fn into_hash(self) -> Hash {
27 self
28 }
29}
30
31impl IntoHash for &str {
32 #[inline]
33 fn into_hash(self) -> Hash {
34 Hash::ident(self)
35 }
36}
37
38impl IntoHash for &Protocol {
39 #[inline]
40 fn into_hash(self) -> Hash {
41 self.hash
42 }
43}