use std::{fmt::Debug, io::Write};

pub fn print_slice<D: Debug, F: Sized + Debug>(writer: &mut impl Write, slice: &[D], size: usize) {
    let slice = unsafe {
        let (a, b, c) = slice.align_to::<F>();
        assert_eq!(a.len(), 0);
        assert_eq!(c.len(), 0);
        b
    };
    writeln!(writer, "\t\t[");
    for elements in slice.chunks(size) {
        write!(writer, "\t\t");
        for element in elements {
            write!(writer, "{:?} ", element);
        }
        writeln!(writer);
    }
    writeln!(writer, "\t\t]");
}
