pub fn apply_diff(diff: &Differ, system: &(Vec<SystemUser>, Vec<SystemGroup>), sync: &LocalRoot) {
    let (add_users, add_groups) = &diff.add;
    let (remove_users, remove_groups) = &diff.remove;
    let (update_users, update_groups) = &diff.update;
    let (system_users, system_groups) = system;

    // Apply group changes
    delete_group(remove_groups);
    update_group(update_groups, system_groups);
    add_group(add_groups);

    // Get an updated group list.
    let system_groups = SystemGroup::parse_file().unwrap_or(system_groups.clone());

    // Apply user changes
    delete_user(remove_users);
    update_user(update_users, system_users, &system_groups);
    add_user(add_users);

    // Apply passwords
    apply_passwords(&sync.users, &sync.encrypted);
}
/**
Apply to the system a diff.
Makes sure both the system and sync file are properly synchonized.

# Parameters
* `diff`: The change to apply.
* `system`: The current system state.
* `sync`: The local sync information.

# Panic
If one of the executed commands fail and is unable to terminate it properly.
 */
Apply to the system a diff.
Makes sure both the system and sync file are properly synchonized.

Parameters
`diff`: The change to apply.
`system`: The current system state.
`sync`: The local sync information.

Panic
If one of the executed commands fail and is unable to terminate it properly.
Apply to the system a diff . Makes sure both the system and sync file are properly synchonized . Parameters ` diff ` : The change to apply . ` system ` : The current system state . ` sync ` : The local sync information . Panic If one of the executed commands fail and is unable to terminate it properly .
pub fn apply_diff(diff: &Differ, system: &(Vec<SystemUser>, Vec<SystemGroup>), sync: &LocalRoot) {
    let (add_users, add_groups) = &diff.add;
    let (remove_users, remove_groups) = &diff.remove;
    let (update_users, update_groups) = &diff.update;
    let (system_users, system_groups) = system;
    // Apply group changes
    delete_group(remove_groups);
    update_group(update_groups, system_groups);
    add_group(add_groups);
    // Get an updated group list.
    let system_groups = SystemGroup::parse_file().unwrap_or(system_groups.clone());
    // Apply user changes
    delete_user(remove_users);
    update_user(update_users, system_users, &system_groups);
    add_user(add_users);
    // Apply passwords
    apply_passwords(&sync.users, &sync.encrypted);
}
pub fn apply_diff ( diff : & Differ , system : & ( Vec < SystemUser > , Vec < SystemGroup > ) , sync : & LocalRoot ) { let ( add_users , add_groups ) = & diff . add ; let ( remove_users , remove_groups ) = & diff . remove ; let ( update_users , update_groups ) = & diff . update ; let ( system_users , system_groups ) = system ; // Apply group changes delete_group ( remove_groups ) ; update_group ( update_groups , system_groups ) ; add_group ( add_groups ) ; // Get an updated group list. let system_groups = SystemGroup :: parse_file ( ) . unwrap_or ( system_groups . clone ( ) ) ; // Apply user changes delete_user ( remove_users ) ; update_user ( update_users , system_users , & system_groups ) ; add_user ( add_users ) ; // Apply passwords apply_passwords ( & sync . users , & sync . encrypted ) ; }
Apply to the system a diff.
Apply to the system a diff .
diff
&Differ
system
&(Vec<SystemUser>, Vec<SystemGroup>)
sync
&LocalRoot
diff
&Differ
system
&(Vec<SystemUser>, Vec<SystemGroup>)
sync
&LocalRoot