From 321f767b3329de9d43fae7bf47bab0ad9e0b5a3b Mon Sep 17 00:00:00 2001 From: alnoki <43892045+alnoki@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:06:16 -0700 Subject: [PATCH] Update contains check --- .../research/red_black_map/sources/red_black_map.move | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/move/research/red_black_map/sources/red_black_map.move b/src/move/research/red_black_map/sources/red_black_map.move index 3771848..2df1185 100644 --- a/src/move/research/red_black_map/sources/red_black_map.move +++ b/src/move/research/red_black_map/sources/red_black_map.move @@ -47,14 +47,9 @@ module econia::red_black_map { Map { root: Pointer::Null, nodes: vector::empty() } } - /* - public fun contains(self: &Map, key: u256): bool { - match (self.search(key)) { - Found { node: _, side_as_child: _ } => true, - NotFound { prospective_parent: _, prospective_side_as_child: _ } => false - } - } - */ + public fun contains(self: &Map, key: u256): bool { + if (self.search(key) is SearchResult::Found) true else false + } public fun insert(self: &mut Map, key: u256, value: V) { match(self.root) {