Skip to content

Commit

Permalink
Update contains check
Browse files Browse the repository at this point in the history
  • Loading branch information
alnoki committed Oct 22, 2024
1 parent 4d88348 commit 321f767
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/move/research/red_black_map/sources/red_black_map.move
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,9 @@ module econia::red_black_map {
Map { root: Pointer::Null, nodes: vector::empty() }
}

/*
public fun contains<V>(self: &Map<V>, key: u256): bool {
match (self.search(key)) {
Found { node: _, side_as_child: _ } => true,
NotFound { prospective_parent: _, prospective_side_as_child: _ } => false
}
}
*/
public fun contains<V: drop>(self: &Map<V>, key: u256): bool {
if (self.search(key) is SearchResult::Found) true else false
}

public fun insert<V: drop>(self: &mut Map<V>, key: u256, value: V) {
match(self.root) {
Expand Down

0 comments on commit 321f767

Please sign in to comment.