Currently, HeaderMap::entry is generic over its argument, allowing lazily parsing a HeaderName, but means that some of those types might not be valid, so entry returns Result<Entry, Error>. When alreadying passing a HeaderName, it causes code to deal with an error that can never happen, like headers.entry(HOST).expect("Host is a valid name").
It'd be nice to add an alternative method that doesn't return a Result, but allows fewer types.
If considered for breaking changes, I'd rename the current to try_entry, and make the new alternative just entry.
Currently,
HeaderMap::entryis generic over its argument, allowing lazily parsing aHeaderName, but means that some of those types might not be valid, soentryreturnsResult<Entry, Error>. When alreadying passing aHeaderName, it causes code to deal with an error that can never happen, likeheaders.entry(HOST).expect("Host is a valid name").It'd be nice to add an alternative method that doesn't return a
Result, but allows fewer types.If considered for breaking changes, I'd rename the current to
try_entry, and make the new alternative justentry.