You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: bytes.rs
    path of file: ./repos/snarkVM/console/program/src/data_types/array_type
    
    the code of the file until where you have to start completion: // Copyright (C) 2019-2023 Aleo Systems Inc.
// This file is part of the snarkVM library.

// Licensed under the Apac
    
    fn write_le<W: Write>(&self, mut writer: W) -> IoResult<()> {
        // Initialize the components to serialize.
        let mut element_type = *self.element_type.clone();
        let mut lengths = Vec::new();
        lengths.push(*self.length());

        // Collect the each dimension of the array.
        // Note that the lengths are in the order of the outermost dimension to the innermost dimension.
        for _ in 1..N::MAX_DATA_DEPTH {
            element_type = match element_type {
                PlaintextType::Literal(_) | PlaintextType::Struct(_) => break,
                PlaintextType::Array(array_type) => {
                    lengths.push(*array_type.length());
                    array_type.next_element_type().clone()
                }
            };
        }

        // Check that the array type does not exceed the maximum depth.
        if let PlaintextType::Array(_) = element_type {
            return Err(error(format!("Array type exceeds the maximum depth of {}.", N::MAX_DATA_DEPTH)));
        }

        // Write the innermost element type.
        match element_type {
            PlaintextType::Literal(literal_type) => {
                0u8.write_le(&mut writer)?;
                literal_type.write_le(&mut writer)?;
            }
            PlaintextType::Struct(identifier) => {
                1u8.write_le(&mut writer)?;
                identifier.write_le(&mut writer)?;
            }
            PlaintextType::Array(_) => {
                // This is technically unreachable by definition, however we return an error
                // out of an abundance of caution.
                return Err(error(format!("Array type exceeds the maximum depth of {}.", N::MAX_DATA_DEPTH)));
            }
        }

        // Write the number of dimensions of the array.
        u8::try_from(lengths.len()).map_err(error)?.write_le(&mut writer)?;

        // Write the lengths of the array.
        for length in lengths {
            length.write_le(&mut writer)?;
        }

        Ok(())
    }