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: token_headers.rs
    path of file: ./repos/firecracker/src/vmm/src/mmds
    
    the code of the file until where you have to start completion: // Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

use std::collections::HashMap;
use std::result::Result;

use micro_http::{HttpHeaderError, RequestError};

/// Header rejected by MMDS.
pub const REJECTED_HEADER: &str = "X-Forwarded-For";

/// Wrapper over the list of token headers associated with a Request.
#[derive(Debug, PartialEq, Eq)]
pub struct TokenHeaders {
    /// The `X-metadata-token` header might be used by HTTP clients to specify a token in order
    /// to authenticate to the session. This is used for guest requests to MMDS only.
    x_metadata_token: Option<String>,
    /// The `X-metadata-token-ttl-seconds` header might be used by HTTP clients to specify
    /// the expiry time of a token. This is used for PUT requests issued by the guest to MMDS only.
    x_metadata_token_ttl_seconds: Option<u32>,
}

impl Default for TokenHeaders {
    /// Token headers are not present in the request by default.
    fn default() -> Self {
        Self {
            x_metadata_token: None,
            x_metadata_token_ttl_seconds: None,
        }
    }
}

impl TokenHeaders {
    /// `X-metadata-token` header.
    const X_METADATA_TOKEN: &'static str = "X-metadata-token";
    /// `X-metadata-token-ttl-seconds` header.
    const X_METADATA_TOKEN_TTL_SECONDS: &'static str = "X-metadata-token-ttl-seconds";

    /// Return `TokenHeaders` from headers map.
    pub fn try_from(map: &HashMap<String, String>) -> Result<TokenHeaders, RequestError> {
        let mut headers = Self::default();
        let lowercased_headers: HashMap<String, String> = map
            .iter()
            .map(|(k, v)| (k.to_lowercase(), v.clone()))
            .collect();

        if let Some(token) =
    
    fn test_try_from_headers() {
        // Empty token header map.
        let map: HashMap<String, String> = HashMap::default();
        let headers = TokenHeaders::try_from(&map).unwrap();
        assert_eq!(headers, TokenHeaders::default());

        // Unrecognised headers.
        let mut map: HashMap<String, String> = HashMap::default();
        map.insert("Some-Header".to_string(), "10".to_string());
        map.insert("Another-Header".to_string(), "value".to_string());
        let headers = TokenHeaders::try_from(&map).unwrap();
        assert_eq!(headers, TokenHeaders::default());

        // Valid headers.
        let mut map: HashMap<String, String> = HashMap::default();
        map.insert("Some-Header".to_string(), "10".to_string());
        map.insert(
            TokenHeaders::X_METADATA_TOKEN_TTL_SECONDS.to_string(),
            "60".to_string(),
        );
        map.insert(
            TokenHeaders::X_METADATA_TOKEN.to_string(),
            "foo".to_string(),
        );
        let headers = TokenHeaders::try_from(&map).unwrap();
        assert_eq!(headers.x_metadata_token_ttl_seconds().unwrap(), 60);
        assert_eq!(*headers.x_metadata_token().unwrap(), "foo".to_string());

        let mut map: HashMap<String, String> = HashMap::default();
        map.insert(TokenHeaders::X_METADATA_TOKEN.to_string(), "".to_string());
        let headers = TokenHeaders::try_from(&map).unwrap();
        assert_eq!(*headers.x_metadata_token().unwrap(), "".to_string());

        // Lowercased headers
        let mut map: HashMap<String, String> = HashMap::default();
        map.insert(
            TokenHeaders::X_METADATA_TOKEN_TTL_SECONDS
                .to_string()
                .to_lowercase(),
            "60".to_string(),
        );
        let headers = TokenHeaders::try_from(&map).unwrap();
        assert_eq!(headers.x_metadata_token_ttl_seconds().unwrap(), 60);

        // Invalid value.
        let mut map: HashMap<String, String> = HashMap::default();
        map.insert(
            TokenHeaders::X_METADATA_TOKEN_TTL_SECONDS.to_string(),
            "-60".to_string(),
        );
        assert_eq!(
            TokenHeaders::try_from(&map).unwrap_err(),
            RequestError::HeaderError(HttpHeaderError::InvalidValue(
                TokenHeaders::X_METADATA_TOKEN_TTL_SECONDS.to_string(),
                "-60".to_string()
            ))
        );
    }