hyperium / headers

Typed HTTP Headers from hyper
https://hyper.rs
MIT License
163 stars 84 forks source link

How to construct a ContentLocation? #192

Open sazzer opened 1 month ago

sazzer commented 1 month ago

I feel like I'm missing something obvious here.

The ContentLocation struct has a private field, so can't be directly constructed. It's also got no new() method and doesn't seem to implement From, TryFrom, FromStr or anything else like that in any useful manner that I can see.

There are also no examples in the RustDoc, and the tests are all in the same module so can construct the struct directly even though my code can't.

So, what am I missing?

Cheers

seanmonstar commented 1 month ago

You're not missing anything obvious, it looks like the type just doesn't have any useful methods.

When the typed headers were first made as part of hyper, we accidentally exposed too many internals, and it required breaking changes, even for headers that someone might not care about. So when moved into this separate crate, internal privacy was improved, and only conservative methods that don't restrict internal refactors have been added.

It was easier to do that for some types. Others, people just haven't submitted proposals for what conservative methods to add.

sazzer commented 1 month ago

So what's the best way to address this? Do I submit a proposal somewhere? Or do I just submit a PR? Or is there some other way?

Cheers