Skip to content

Commit

Permalink
Add Move v2 instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
alnoki committed Sep 30, 2024
1 parent 71e6336 commit 4d88348
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 7 additions & 1 deletion src/move/research/red_black_map/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Ensure proper `movefmt` version >= `1.0.5`:

```sh
aptos update movefmt --target-version 1.0.5
```

Test and format:

```sh
aptos move test --dev --move-2
movefmt --file-path sources/red_black_map.move
aptos move fmt
```
12 changes: 7 additions & 5 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,12 +47,14 @@ 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 { .. } => true,
NotFound { .. } => false
/*
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 insert<V: drop>(self: &mut Map<V>, key: u256, value: V) {
match(self.root) {
Expand Down

0 comments on commit 4d88348

Please sign in to comment.