microwfc 0.6.1

Small Wave-Function-Collapse implementation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Trait to extract unique items from collections.
pub trait Unique {
    /// Returns the same collection, but with all duplicates removed
    fn unique(&self) -> Self;
}

impl<T: Clone + PartialEq> Unique for Vec<T> {
    fn unique(&self) -> Self {
        let mut r = Vec::new();
        for item in self {
            if !r.contains(item) {
                r.push(item.clone());
            }
        }
        r
    }
}