You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR provides the following `UnionFind` methods, that are free from
panics:
```rust
pub fn try_find(&self, mut x: K) -> Option<K>
pub fn try_find_mut(&mut self, x: K) -> Option<K>
pub fn try_equiv(&self, x: K, y: K) -> Result<bool, K>
pub fn try_union(&mut self, x: K, y: K) -> Result<bool, K>
```
Some of old methods were rewritten using the `try` twins with the
addition of `.unwrap` or `.expect`, for example:
```rust
pub fn find(&self, x: K) -> K {
self.try_find(x).expect("The index is out of bounds")
}
```
If you consider these changes to be critical & breaking, I will return
back the old `assert`ions.
I'm open to discussion!
0 commit comments