mirror of
https://github.com/status-im/nim-stew.git
synced 2025-02-16 14:08:14 +00:00
Add hashes.hashAllFields
This commit is contained in:
parent
a98ec09b0b
commit
2f9c61f485
10
stew/shims/hashes.nim
Normal file
10
stew/shims/hashes.nim
Normal file
@ -0,0 +1,10 @@
|
||||
import
|
||||
std/[hashes, typetraits]
|
||||
|
||||
func hashAllFields*(x: object|tuple): Hash =
|
||||
mixin hash
|
||||
for f in fields(x):
|
||||
result = result !& hash(f)
|
||||
result = !$result
|
||||
|
||||
export hashes
|
Loading…
x
Reference in New Issue
Block a user