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: entity_selector.rs
    path of file: ./repos/valence/crates/valence_command/src/parsers
    
    the code of the file until where you have to start completion: use super::Parser;
use crate::parsers::{CommandArg, CommandArgParseError, ParseInput};

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum EntitySelector {
    SimpleSelector(EntitySelectors),
    ComplexSelector(EntitySelectors, String),
}

#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub enum EntitySelectors {
    AllEntities,
 
    
    fn parse_arg(input: &mut ParseInput) -> Result<Self, CommandArgParseError> {
        input.skip_whitespace();
        let mut simple_selector = None;
        while let Some(c) = input.peek() {
            match c {
                '@' => {
                    input.pop(); // pop the '@'
                    match input.pop() {
                        Some('e') => simple_selector = Some(EntitySelectors::AllEntities),
                        Some('a') => simple_selector = Some(EntitySelectors::AllPlayers),
                        Some('p') => simple_selector = Some(EntitySelectors::NearestPlayer),
                        Some('r') => simple_selector = Some(EntitySelectors::RandomPlayer),
                        Some('s') => simple_selector = Some(EntitySelectors::SelfPlayer),
                        _ => {
                            return Err(CommandArgParseError::InvalidArgument {
                                expected: "entity selector".to_string(),
                                got: c.to_string(),
                            })
                        }
                    }
                    if input.peek() != Some('[') {
                        // if there's no complex selector, we're done
                        return Ok(EntitySelector::SimpleSelector(simple_selector.unwrap()));
                    }
                }
                '[' => {
                    input.pop();
                    if simple_selector.is_none() {
                        return Err(CommandArgParseError::InvalidArgument {
                            expected: "entity selector".to_string(),
                            got: c.to_string(),
                        });
                    }
                    let mut s = String::new();
                    while let Some(c) = input.pop() {
                        if c == ']' {
                            return Ok(EntitySelector::ComplexSelector(
                                simple_selector.unwrap(),
                                s.trim().to_string(),
                            ));
                        } else {
                            s.push(c);
                        }
                    }
                }
                _ => {
                    return Ok(EntitySelector::SimpleSelector(
                        EntitySelectors::SinglePlayer(String::parse_arg(input)?),
                    ))
                }
            }
        }
        Err(CommandArgParseError::InvalidArgLength)
    }