orium/rpds

`RedBlackTreeSet`'s docs mention non-existent `get` operation

phrohdoh opened this issue · 2 comments

/// | Operation | Average | Worst case |
/// |:-------------------------- | ---------:| -----------:|
/// | `new()` | Θ(1) | Θ(1) |
/// | `insert()` | Θ(log(n)) | Θ(log(n)) |
/// | `remove()` | Θ(log(n)) | Θ(log(n)) |
/// | `get()` | Θ(log(n)) | Θ(log(n)) |
/// | `contains()` | Θ(log(n)) | Θ(log(n)) |
/// | `size()` | Θ(1) | Θ(1) |
/// | `clone()` | Θ(1) | Θ(1) |
/// | iterator creation | Θ(log(n)) | Θ(log(n)) |
/// | iterator step | Θ(1) | Θ(log(n)) |
/// | iterator full | Θ(n) | Θ(n) |

error[E0599]: no method named `get` found for struct `RedBlackTreeSet` in the current scope
   --> src/lib.rs:456:17
    |
456 |             set.get(x)
    |                 ^^^ method not found in `RedBlackTreeSet<Val>`

For my use-case it'd be useful to have a get that returned the given key, as if the set were a map where the keys are also the values, (or None, some value indicating lack of value in the set).

I can wrap the set type(s) with a custom implementation to achieve the above, but worry about losing the traits/impls that the set type(s) already have (or having to forward, with whatever pain may come).

orium commented

Implemented. Will cut a release now.

Thank you!