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: class.rs
    path of file: ./repos/jvm-old/jvm/src
    
    the code of the file until where you have to start completion: use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use std::collections::HashMap;
use std::io::{Cursor, Read, 
    
    pub fn parse(desc: &str) -> Result<FieldDescriptor, ParseError> {
        if "BCDFIJSZ".contains(&desc[0..1]) {
            //BaseType
            return Ok(FieldDescriptor::JavaType(JavaType::get(&desc[0..1])?));
        } else if &desc[0..1] == "L" {
            //ObjectType
            return Ok(FieldDescriptor::ObjectType(String::from(
                &desc[1..desc.len() - 1],
            )));
        } else if &desc[0..1] == "[" {
            //ArrayType
            let mut dimensions: usize = 0;
            for i in 0..desc.len() {
                if &desc[i..i + 1] != "[" {
                    dimensions = i;
                    break;
                } else if i == desc.len() - 1 {
                    panic!("Invalid FieldDescriptor, no end of array type!");
                }
            }

            if "BCDFIJSZ".contains(&desc[dimensions..dimensions + 1]) {
                //BaseType
                return Ok(FieldDescriptor::ArrayType(ArrayType {
                    dimensions: dimensions as u8,
                    field_descriptor: Box::new(FieldDescriptor::JavaType(JavaType::get(
                        &desc[dimensions..dimensions + 1],
                    )?)),
                }));
            } else if &desc[dimensions..dimensions + 1] == "L" {
                //ObjectType
                return Ok(FieldDescriptor::ArrayType(ArrayType {
                    dimensions: dimensions as u8,
                    field_descriptor: Box::new(FieldDescriptor::ObjectType(String::from(
                        &desc[dimensions + 1..desc.len() - 1],
                    ))),
                }));
            }
        }

        Result::Err(ParseError::MalformedDescriptor)
    }