MCPcopy Index your code
hub / github.com/RustPython/RustPython / hash

Method hash

crates/compiler-core/src/bytecode.rs:918–939  ·  view source on GitHub ↗
(&self, state: &mut H)

Source from the content-addressed store, hash-verified

916
917impl 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

Callers 2

hash_iterMethod · 0.45
keyed_hashFunction · 0.45

Calls 2

hashFunction · 0.85
as_refMethod · 0.45

Tested by

no test coverage detected