Skip to content

Conversation

@yoshuawuyts
Copy link
Member

Implements ToHeaderValues for more string types. Noticed that passing &format!("{}", "value") as the header value didn't work, but format!("{}", "value").as_str() does. This fixes that. Thanks!

Copy link
Member

@jbr jbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could these be defined in terms of the ToHeaderValues for &'a str impl to reduce duplicated code? Similarly, the String one probably could also be defined as

impl ToHeaderValues for String {
    type Iter = option::IntoIter<HeaderValue>;

    fn to_header_values(&self) -> crate::Result<Self::Iter> {
        self.as_str().to_header_values()
    }
}

That way if changes were needed to the &str impl, it wouldn't have to be repeated in four places

@yoshuawuyts yoshuawuyts merged commit 72d8827 into main Nov 13, 2020
@delete-merged-branch delete-merged-branch bot deleted the to-header-values-for-more-string-types branch November 13, 2020 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants