diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-08-13 02:35:57 +0000 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-08-23 03:06:55 +0000 |
| commit | 33653002e66f83ec10f4382dd4ad3c18dbf2abff (patch) | |
| tree | 1bdd0ba172ee43f191052ff405ee03a9a892618a /lib/kernel | |
| parent | afbab0968340abcec044d9ac70c4a3ec0756933e (diff) | |
| download | RNT-33653002e66f83ec10f4382dd4ad3c18dbf2abff.tar.gz RNT-33653002e66f83ec10f4382dd4ad3c18dbf2abff.zip | |
Move StringKey out of the tests
Diffstat (limited to 'lib/kernel')
| -rw-r--r-- | lib/kernel/Merkle.ml | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/kernel/Merkle.ml b/lib/kernel/Merkle.ml index 6f342cd..49f4fda 100644 --- a/lib/kernel/Merkle.ml +++ b/lib/kernel/Merkle.ml @@ -339,3 +339,11 @@ module Interface : INTERFACE = functor (S : Abstract.Storage.STORAGE) (K : KEY) | Some addr -> retrieve tx addr end + +module StringKey : KEY with type t = string = struct + type t = string + + let encode s = String.to_bytes s |> Concepts.Representation.blob_of_bytes + let compare s1 s2 = String.compare s1 s2 |> Concepts.Ordering.of_int + let decode b = Concepts.Representation.bytes_of_blob b |> String.of_bytes |> Result.ok +end |
