aboutsummaryrefslogtreecommitdiffstats
path: root/lib/protocols/Handle.ml
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-08-29 01:14:18 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-08-29 01:14:18 +0000
commitb2a9404cbfa4e38391d345e137f6dbda963d960d (patch)
tree4150dfa887565449a8f2b14eccf51459d54aae48 /lib/protocols/Handle.ml
parente61404f0219cd8f07c6c278f7ee952c70ce5bdf4 (diff)
downloadRNT-b2a9404cbfa4e38391d345e137f6dbda963d960d.tar.gz
RNT-b2a9404cbfa4e38391d345e137f6dbda963d960d.zip
Handle equality
Diffstat (limited to '')
-rw-r--r--lib/protocols/Handle.ml4
-rw-r--r--lib/protocols/Handle.mli2
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/protocols/Handle.ml b/lib/protocols/Handle.ml
index 9fd1f29..23af476 100644
--- a/lib/protocols/Handle.ml
+++ b/lib/protocols/Handle.ml
@@ -3,6 +3,7 @@ type protocol = ..
class type obj = object
method reference : bool
method release : unit
+ method hash : Concepts.Hash.hash
method protocols : protocol list
end
@@ -35,6 +36,9 @@ let copy handle =
else
None
+let equal h1 h2 =
+ Concepts.Hash.hash_equals (object_of h1)#hash (object_of h2)#hash
+
let release ({ valid; _ } as handle) =
let o = object_of handle in
valid := false;
diff --git a/lib/protocols/Handle.mli b/lib/protocols/Handle.mli
index 099f563..fb93cdd 100644
--- a/lib/protocols/Handle.mli
+++ b/lib/protocols/Handle.mli
@@ -7,6 +7,7 @@ type protocol = ..
class type obj = object
method reference : bool
method release : unit
+ method hash : Concepts.Hash.hash
method protocols : protocol list
end
@@ -17,4 +18,5 @@ val into : t -> (protocol -> 'a option) -> 'a interface option
val invoke : 'a interface -> ('a -> 'b) -> 'b
val copy : t -> t option
+val equal : t -> t -> bool
val release : t -> unit