selene-core 0.7.1

selene-core is the backend for Selene, a local-first music player
Documentation
// pub(crate) fn patch_replace<T>(target: &mut T, patch: Option<T>) {
//     if let Some(value) = patch {
//         *target = value;
//     }
// }

pub(crate) fn patch_option_replace<T>(target: &mut Option<T>, patch: Option<T>) {
    if let Some(value) = patch {
        *target = Some(value);
    }
}

pub(crate) fn patch_vec<T: Eq>(target: &mut Vec<T>, patch: impl IntoIterator<Item = T>) {
    for item in patch {
        if !target.contains(&item) {
            target.push(item);
        }
    }
}