fn new(layers: usize, height: usize, width: usize, data: &str) -> Self {
        assert_eq!(layers*height*width, data.len());
        let mut image = Image(vec![vec![vec![0; width]; height]; layers]);
        let mut characters = data.chars();
        for layer in 0..layers {
            for row in 0..height {
                for column in 0..width {
                    image[layer][row][column] = characters
                        .next()
                        .expect("Unexpected number of characters in data.")
                        .to_digit(10)
                        .expect("Encountered a character that was not a base-10 digit.") as u8;
                }
            }
        }
        image
    }
// Create a new image given the total number of layers, rows, and columns, and some initial data.
Create a new image given the total number of layers, rows, and columns, and some initial data.
Create a new image given the total number of layers rows and columns and some initial data .
fn new(layers: usize, height: usize, width: usize, data: &str) -> Self {
        assert_eq!(layers*height*width, data.len());
        let mut image = Image(vec![vec![vec![0; width]; height]; layers]);
        let mut characters = data.chars();
        for layer in 0..layers {
            for row in 0..height {
                for column in 0..width {
                    image[layer][row][column] = characters
                        .next()
                        .expect("Unexpected number of characters in data.")
                        .to_digit(10)
                        .expect("Encountered a character that was not a base-10 digit.") as u8;
                }
            }
        }
        image
    }
fn new ( layers : usize , height : usize , width : usize , data : & str ) -> Self { assert_eq ! ( layers height width data len ( ) ) ; let mut image = Image ( vec ! [ vec [ vec [ 0 width ] height ] layers ] ) ; let mut characters = data . chars ( ) ; for layer in 0 .. layers { for row in 0 .. height { for column in 0 .. width { image [ layer ] [ row ] [ column ] = characters . next ( ) . expect ( " " ) . to_digit ( 10 ) . expect ( " " ) as u8 ; } } } image }
Create a new image given the total number of layers, rows, and columns, and some initial data.
Create a new image given the total number of layers rows and columns and some initial data .
layers
usize
height
usize
width
usize
data
&str