tinkr 0.0.43

Tinkr is a web framework for quickly building full-stack web applications with Leptos.
Documentation
pub trait ArrayUtils<T> {
    fn unique<F>(self, comparator: F) -> Vec<T>
    where
        F: FnMut(&T, &T) -> bool;
}

impl<T> ArrayUtils<T> for Vec<T> {
    fn unique<F>(self, mut comparator: F) -> Vec<T>
    where
        F: FnMut(&T, &T) -> bool,
    {
        let mut result = Vec::new();

        for item in self {
            if !result.iter().any(|existing| comparator(existing, &item)) {
                result.push(item);
            }
        }

        result
    }
}