(&self, state: &mut H)
| 916 | |
| 917 | impl hash::Hash for ConstantData { |
| 918 | fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 919 | use ConstantData::*; |
| 920 | |
| 921 | mem::discriminant(self).hash(state); |
| 922 | match self { |
| 923 | Integer { value } => value.hash(state), |
| 924 | Float { value } => value.to_bits().hash(state), |
| 925 | Complex { value } => { |
| 926 | value.re.to_bits().hash(state); |
| 927 | value.im.to_bits().hash(state); |
| 928 | } |
| 929 | Boolean { value } => value.hash(state), |
| 930 | Str { value } => value.hash(state), |
| 931 | Bytes { value } => value.hash(state), |
| 932 | Code { code } => core::ptr::hash(code.as_ref(), state), |
| 933 | Tuple { elements } => elements.hash(state), |
| 934 | Slice { elements } => elements.hash(state), |
| 935 | Frozenset { elements } => elements.hash(state), |
| 936 | None => {} |
| 937 | Ellipsis => {} |
| 938 | } |
| 939 | } |
| 940 | } |
| 941 | |
| 942 | /// A borrowed Constant |
no test coverage detected