unionfind 0.2.1

A union find library made for building type inference engines. Can be used as general purpose datastructure.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::convert::Infallible;

pub trait Union<T> {
    type Err;

    fn union(&self, a: T, b: T) -> Result<T, Self::Err>;
}

impl<F, T> Union<T> for F
where
    F: Fn(T, T) -> T,
{
    type Err = Infallible;

    fn union(&self, a: T, b: T) -> Result<T, Self::Err> {
        Ok((self)(a, b))
    }
}