Skip to main content

rebased_by

Function rebased_by 

Source
pub fn rebased_by<T: PartialEq + Clone>(
    shown: &[T],
    value: &[T],
    current: &[T],
    ids: impl Fn(&[T]) -> Vec<Option<String>>,
    real: bool,
) -> Vec<T>
Expand description

rebased, for a list of structured elements (days off, hours, routes): an element the editor changed is its new version in place of the one the list holds now. Found by its id (ids, real: a day off’s), whatever it holds now: two devices changing it keep one, the later change. By a key (ids, not real: a day’s window by its rank, which a window added elsewhere shifts) only while the element there is the one shown, else by what it held wherever it is now; not there, nothing is replaced and the other device’s elements stay. Without an id (a route): at its place while it holds what was shown, else by what it held wherever it is, else at its place while the list holds as many as shown (the same element, changed elsewhere: the later change).