How to split Vec into chunks

Use the chunks method to iterate over fixed-size groups or split_at_mut to divide a mutable vector into two distinct parts.

Use the chunks method on a slice to get an iterator over fixed-size chunks, or split_at_mut to divide a mutable vector into two parts at a specific index.

fn main() {
    let v = vec![1, 2, 3, 4, 5, 6];
    
    // Iterate over chunks of 2
    for chunk in v.chunks(2) {
        println!("{:?}", chunk);
    }

    // Split mutable vector into two parts
    let mut v_mut = vec![1, 2, 3, 4, 5, 6];
    let (left, right) = v_mut.split_at_mut(3);
    println!("Left: {:?}, Right: {:?}", left, right);
}