pub fn try_from(map: &HashMap<String, String>) -> Result<TokenHeaders, RequestError> {
        let mut headers = Self::default();

        if let Some(token) = map.get(TokenHeaders::X_METADATA_TOKEN) {
            headers.x_metadata_token = Some(token.to_string());
        }

        if let Some(value) = map.get(TokenHeaders::X_METADATA_TOKEN_TTL_SECONDS) {
            match value.parse::<u32>() {
                Ok(seconds) => {
                    headers.x_metadata_token_ttl_seconds = Some(seconds);
                }
                Err(_) => {
                    return Err(RequestError::HeaderError(HttpHeaderError::InvalidValue(
                        TokenHeaders::X_METADATA_TOKEN_TTL_SECONDS.to_string(),
                        value.to_string(),
                    )));
                }
            }
        }

        Ok(headers)
    }
/// Return `TokenHeaders` from headers map.
Return `TokenHeaders` from headers map.
Return ` TokenHeaders ` from headers map .
pub fn try_from(map: &HashMap<String, String>) -> Result<TokenHeaders, RequestError> {
        let mut headers = Self::default();
        if let Some(token) = map.get(TokenHeaders::X_METADATA_TOKEN) {
            headers.x_metadata_token = Some(token.to_string());
        }
        if let Some(value) = map.get(TokenHeaders::X_METADATA_TOKEN_TTL_SECONDS) {
            match value.parse::<u32>() {
                Ok(seconds) => {
                    headers.x_metadata_token_ttl_seconds = Some(seconds);
                }
                Err(_) => {
                    return Err(RequestError::HeaderError(HttpHeaderError::InvalidValue(
                        TokenHeaders::X_METADATA_TOKEN_TTL_SECONDS.to_string(),
                        value.to_string(),
                    )));
                }
            }
        }
        Ok(headers)
    }
pub fn try_from ( map : & HashMap < String , String > ) -> Result < TokenHeaders , RequestError > { let mut headers = Self :: default ( ) ; if let Some ( token ) = map . get ( TokenHeaders :: X_METADATA_TOKEN ) { headers . x_metadata_token = Some ( token . to_string ( ) ) ; } if let Some ( value ) = map . get ( TokenHeaders :: X_METADATA_TOKEN_TTL_SECONDS ) { match value . parse :: < u32 > ( ) { Ok ( seconds ) => { headers . x_metadata_token_ttl_seconds = Some ( seconds ) ; } Err ( _ ) => { return Err ( RequestError :: HeaderError ( HttpHeaderError :: InvalidValue ( TokenHeaders :: X_METADATA_TOKEN_TTL_SECONDS . to_string ( ) , value . to_string ( ) , ) ) ) ; } } } Ok ( headers ) }
Return `TokenHeaders` from headers map.
Return ` TokenHeaders ` from headers map .
map
&HashMap<String, String>
map
&HashMap<String, String>