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: cli_args.rs
    path of file: ./repos/gnirehtet/relay-rust/src
    
    the code of the file until where you have to start completion: /*
 * Copyright (C) 2017 Genymobile
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this 
    
    pub fn parse<S: Into<String>>(accepted_parameters: u8, args: Vec<S>) -> Result<Self, String> {
        let mut serial = None;
        let mut dns_servers = None;
        let mut routes = None;
        let mut port = 0;

        let mut iter = args.into_iter();
        while let Some(arg) = iter.next() {
            let arg = arg.into();
            if (accepted_parameters & PARAM_DNS_SERVERS) != 0 && "-d" == arg {
                if dns_servers.is_some() {
                    return Err(String::from("DNS servers already set"));
                }
                if let Some(value) = iter.next() {
                    dns_servers = Some(value.into());
                } else {
                    return Err(String::from("Missing -d parameter"));
                }
            } else if (accepted_parameters & PARAM_ROUTES) != 0 && "-r" == arg {
                if routes.is_some() {
                    return Err(String::from("Routes already set"));
                }
                if let Some(value) = iter.next() {
                    routes = Some(value.into());
                } else {
                    return Err(String::from("Missing -r parameter"));
                }
            } else if (accepted_parameters & PARAM_PORT) != 0 && "-p" == arg {
                if port != 0 {
                    return Err(String::from("Port already set"));
                }
                if let Some(value) = iter.next() {
                    port = value.into().parse().unwrap();
                    if port == 0 {
                        return Err(String::from("Invalid port: 0"));
                    }
                } else {
                    return Err(String::from("Missing -p parameter"));
                }
            } else if (accepted_parameters & PARAM_SERIAL) != 0 && serial.is_none() {
                serial = Some(arg);
            } else {
                return Err(format!("Unexpected argument: \"{}\"", arg));
            }
        }
        if port == 0 {
            port = DEFAULT_PORT;
        }
        Ok(Self {
            serial,
            dns_servers,
            routes,
            port,
        })
    }