fn weight_unsequenced_tasks(
    unsequenced_tasks: &[SwanlingTask],
    u: usize,
) -> (Vec<Vec<usize>>, usize) {
    // Build a vector of vectors to be used to schedule users.
    let mut available_unsequenced_tasks = Vec::with_capacity(unsequenced_tasks.len());
    let mut total_tasks = 0;
    for task in unsequenced_tasks.iter() {
        // divide by greatest common divisor so vector is as short as possible
        let weight = task.weight / u;
        trace!(
            "{}: {} has weight of {} (reduced with gcd to {})",
            task.tasks_index,
            task.name,
            task.weight,
            weight
        );
        let weighted_tasks = vec![task.tasks_index; weight];
        available_unsequenced_tasks.push(weighted_tasks);
        total_tasks += weight;
    }
    (available_unsequenced_tasks, total_tasks)
}
/// Build a weighted vector of vectors of unsequenced SwanlingTasks.
Build a weighted vector of vectors of unsequenced SwanlingTasks.
Build a weighted vector of vectors of unsequenced SwanlingTasks .
fn weight_unsequenced_tasks(
    unsequenced_tasks: &[SwanlingTask],
    u: usize,
) -> (Vec<Vec<usize>>, usize) {
    // Build a vector of vectors to be used to schedule users.
    let mut available_unsequenced_tasks = Vec::with_capacity(unsequenced_tasks.len());
    let mut total_tasks = 0;
    for task in unsequenced_tasks.iter() {
        // divide by greatest common divisor so vector is as short as possible
        let weight = task.weight / u;
        trace!(
            "{}: {} has weight of {} (reduced with gcd to {})",
            task.tasks_index,
            task.name,
            task.weight,
            weight
        );
        let weighted_tasks = vec![task.tasks_index; weight];
        available_unsequenced_tasks.push(weighted_tasks);
        total_tasks += weight;
    }
    (available_unsequenced_tasks, total_tasks)
}
fn weight_unsequenced_tasks ( unsequenced_tasks : & [ SwanlingTask ] , u : usize , ) -> ( Vec < Vec < usize > > , usize ) { // Build a vector of vectors to be used to schedule users. let mut available_unsequenced_tasks = Vec :: with_capacity ( unsequenced_tasks . len ( ) ) ; let mut total_tasks = 0 ; for task in unsequenced_tasks . iter ( ) { // divide by greatest common divisor so vector is as short as possible let weight = task . weight / u ; trace ! ( " " task tasks_index task name task weight weight ) ; let weighted_tasks = vec ! [ task tasks_index weight ] ; available_unsequenced_tasks . push ( weighted_tasks ) ; total_tasks += weight ; } ( available_unsequenced_tasks , total_tasks ) }
Build a weighted vector of vectors of unsequenced SwanlingTasks.
Build a weighted vector of vectors of unsequenced SwanlingTasks .
unsequenced_tasks
&[SwanlingTask]
u
usize