fn detect_remove(
        sync: &LocalRoot,
        system: &(Vec<SystemUser>, Vec<SystemGroup>),
    ) -> (Vec<SystemUser>, Vec<SystemGroup>) {
        let sync_users = &sync.users;
        let sync_groups = &sync.groups;
        let (system_users, system_groups) = system;

        // Look for any user in the `system_users` list and not in the `sync_users` list.
        let remove_users: Vec<SystemUser> = system_users
            .iter()
            .filter(|system_user| {
                sync_users
                    .iter()
                    .find(|sync_user| system_user.username == sync_user.username)
                    .is_none()
            })
            .map(|user| user.clone())
            .collect();

        // Look for any user in the `system_groups` list and not in the `sync_groups` list.
        let remove_groups: Vec<SystemGroup> = system_groups
            .iter()
            .filter(|system_group| {
                sync_groups
                    .iter()
                    .find(|sync_group| system_group.name == sync_group.name)
                    .is_none()
            })
            .map(|user| user.clone())
            .collect();

        (remove_users, remove_groups)
    }
/**
    Find all the users and groups that needs to be removed from the system.

    # Parameters
    * `sync`: A reference to the `LocalRoot` of the sync file.
    * `system`: A reference to the tuple with the list of system users (0) and system groups (1).

    # Returns
    A tuple with the list of users (0) and groups (1) to be removed from the system.
     */
Find all the users and groups that needs to be removed from the system.
Find all the users and groups that needs to be removed from the system .
fn detect_remove(
        sync: &LocalRoot,
        system: &(Vec<SystemUser>, Vec<SystemGroup>),
    ) -> (Vec<SystemUser>, Vec<SystemGroup>) {
        let sync_users = &sync.users;
        let sync_groups = &sync.groups;
        let (system_users, system_groups) = system;
        // Look for any user in the `system_users` list and not in the `sync_users` list.
        let remove_users: Vec<SystemUser> = system_users
            .iter()
            .filter(|system_user| {
                sync_users
                    .iter()
                    .find(|sync_user| system_user.username == sync_user.username)
                    .is_none()
            })
            .map(|user| user.clone())
            .collect();
        // Look for any user in the `system_groups` list and not in the `sync_groups` list.
        let remove_groups: Vec<SystemGroup> = system_groups
            .iter()
            .filter(|system_group| {
                sync_groups
                    .iter()
                    .find(|sync_group| system_group.name == sync_group.name)
                    .is_none()
            })
            .map(|user| user.clone())
            .collect();
        (remove_users, remove_groups)
    }
fn detect_remove ( sync : & LocalRoot , system : & ( Vec < SystemUser > , Vec < SystemGroup > ) , ) -> ( Vec < SystemUser > , Vec < SystemGroup > ) { let sync_users = & sync . users ; let sync_groups = & sync . groups ; let ( system_users , system_groups ) = system ; // Look for any user in the `system_users` list and not in the `sync_users` list. let remove_users : Vec < SystemUser > = system_users . iter ( ) . filter ( | system_user | { sync_users . iter ( ) . find ( | sync_user | system_user . username == sync_user . username ) . is_none ( ) } ) . map ( | user | user . clone ( ) ) . collect ( ) ; // Look for any user in the `system_groups` list and not in the `sync_groups` list. let remove_groups : Vec < SystemGroup > = system_groups . iter ( ) . filter ( | system_group | { sync_groups . iter ( ) . find ( | sync_group | system_group . name == sync_group . name ) . is_none ( ) } ) . map ( | user | user . clone ( ) ) . collect ( ) ; ( remove_users , remove_groups ) }
Find all the users and groups that needs to be removed from the system.
Find all the users and groups that needs to be removed from the system .
sync
&LocalRoot
system
&(Vec<SystemUser>, Vec<SystemGroup>)
A tuple with the list of users (0) and groups (1) to be removed from the system.
A tuple with the list of users ( 0 ) and groups ( 1 ) to be removed from the system .
sync
&LocalRoot
system
&(Vec<SystemUser>, Vec<SystemGroup>)