Skip to content

Add TryFrom implementations for owned types for HeaderName#479

Merged
seanmonstar merged 1 commit intohyperium:masterfrom
sagebind:headername-tryfrom-owned
Apr 16, 2021
Merged

Add TryFrom implementations for owned types for HeaderName#479
seanmonstar merged 1 commit intohyperium:masterfrom
sagebind:headername-tryfrom-owned

Conversation

@sagebind
Copy link
Contributor

HeaderValue implements TryFrom over both reference and owned types, but HeaderName does not. This seemed like an accidental omission to me rather than something intentionally absent. Including this conversion slightly increases ergonomics by allowing you to create a HeaderMap from a HashMap<String, String> and in similar other constraints.

See also sagebind/isahc#314.

`HeaderValue` implements `TryFrom` over both reference and owned types, but `HeaderName` does not. This seemed like an accidental omission to me rather than something intentionally absent. Including this conversion slightly increases ergonomics by allowing you to create a `HeaderMap` from a `HashMap<String, String>` and in similar other constraints.

See also sagebind/isahc#314.
Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

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

Yep, looks like an oversight to me, thanks!

@seanmonstar seanmonstar merged commit fc49fe3 into hyperium:master Apr 16, 2021
@sagebind sagebind deleted the headername-tryfrom-owned branch April 16, 2021 22:31
BenxiangGe pushed a commit to BenxiangGe/http that referenced this pull request Jul 26, 2021
)

`HeaderValue` implements `TryFrom` over both reference and owned types, but `HeaderName` does not. This seemed like an accidental omission to me rather than something intentionally absent. Including this conversion slightly increases ergonomics by allowing you to create a `HeaderMap` from a `HashMap<String, String>` and in similar other constraints.

See also sagebind/isahc#314.
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.

2 participants