Skip to main content

matchmaker_partial/
traits.rs

1use crate::PartialSetError;
2
3pub trait Set {
4    fn set(&mut self, path: &[String], val: &[String]) -> Result<(), PartialSetError>;
5}
6
7pub trait Merge {
8    fn merge(&mut self, other: Self);
9    fn clear(&mut self);
10}
11
12pub trait Apply {
13    type Partial;
14
15    fn apply(&mut self, partial: Self::Partial);
16}
17
18pub fn from<T: Default + Apply<Partial = Q>, Q>(partial: Q) -> T {
19    let mut base = T::default();
20    base.apply(partial);
21    base
22}