pub fn new<T: Copy + Into<f64>>(source_values: &[T]) -> Self {
        let order = (source_values.len() as f64).sqrt() as usize;

        if source_values.len() != order.pow(2) {
            panic!("Number of source values is not a square value");
        }

        let mut values = Vec::with_capacity(order);

        for source_row in source_values.chunks_exact(order) {
            values.push(
                source_row
                    .iter()
                    .map(|value| (*value).into())
                    .collect::<Vec<_>>(),
            );
        }

        Self { values }
    }
// There isn't an entirely clean structure for the values to pass:
//
// - an array of arrays doesn't work, since the size must be known at compile time;
// - a flat list could work with by appending an empty comment to each line, but as soon as a method
//   is invoked on an entry (e.g. into()), it alignes vertically.
// - using slices works, although it's quite ugly.
//
// So, screw rustfmt, and just use `#[rustfmt::skip]`.
//
There isn't an entirely clean structure for the values to pass:
an array of arrays doesn't work, since the size must be known at compile time;
a flat list could work with by appending an empty comment to each line, but as soon as a method
is invoked on an entry ), it alignes vertically.
using slices works, although it's quite ugly.

So, screw rustfmt, and just use `#[rustfmt::skip]`.
There isn ' t an entirely clean structure for the values to pass : an array of arrays doesn ' t work since the size must be known at compile time ; a flat list could work with by appending an empty comment to each line but as soon as a method is invoked on an entry ) it alignes vertically . using slices works although it ' s quite ugly . So screw rustfmt and just use ` # [ rustfmt :: skip ] ` .
pub fn new<T: Copy + Into<f64>>(source_values: &[T]) -> Self {
        let order = (source_values.len() as f64).sqrt() as usize;
        if source_values.len() != order.pow(2) {
            panic!("Number of source values is not a square value");
        }
        let mut values = Vec::with_capacity(order);
        for source_row in source_values.chunks_exact(order) {
            values.push(
                source_row
                    .iter()
                    .map(|value| (*value).into())
                    .collect::<Vec<_>>(),
            );
        }
        Self { values }
    }
pub fn new < T : Copy + Into < f64 > > ( source_values : & [ T ] ) -> Self { let order = ( source_values . len ( ) as f64 ) . sqrt ( ) as usize ; if source_values . len ( ) != order . pow ( 2 ) { panic ! ( " " ) ; } let mut values = Vec :: with_capacity ( order ) ; for source_row in source_values . chunks_exact ( order ) { values . push ( source_row . iter ( ) . map ( | value | ( * value ) . into ( ) ) . collect :: < Vec < _ > > ( ) , ) ; } Self { values } }
There isn't an entirely clean structure for the values to pass:
 an array of arrays doesn't work, since the size must be known at compile time;
 a flat list could work with by appending an empty comment to each line, but as soon as a method
is invoked on an entry (e.g.
There isn ' t an entirely clean structure for the values to pass : an array of arrays doesn ' t work since the size must be known at compile time ; a flat list could work with by appending an empty comment to each line but as soon as a method is invoked on an entry ( e . g .
source_values
&[T]