/* rust vec testing stuff */

#![allow(non_snake_case)]

fn cutC<X>(x: Vec<X>, w: usize) -> Vec<Vec<X>>
where
    X: Copy,
{
    let L = x.len();
    let mut it = x.into_iter();
    let mut i = 0;
    let mut r = Vec::new();

    while (i * w) + w <= L {
        let row = it.by_ref().take(w).collect::<Vec<_>>();
        r.push(row);
        i += 1;
    }

    r
}

fn main() {
    let a = cutC(vec![1, 2, 3, 4, 5, 6, 7, 8, 9], 3);
    println!("{a:?}");
}
