Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up1.0 Release Discussion / Wishlist #52
Comments
This comment has been minimized.
This comment has been minimized.
|
I just did a large redesign of this crate, resulting in v0.3. I realize reqwest is on the road to 1.0, and it publicly relies on mime, so there does need to be a way forward. I feel that the new design 0.3 is one that can be stabilized, with one possible caveat. I'm uncertain if I'd rather all the mime constants to be on the Should you do Besides that, I think there just needs some usage out of 0.3, which should happen much more so when hyper releases 0.11, which contains the upgrade. |
This comment has been minimized.
This comment has been minimized.
|
From a high-level perspective, I think I would prefer to see the constants contained within a submodule, perhaps namespaced by top-level type, e.g.:
This would help avoid polluting the crate root namespace as more constants are added. I think as far as desired APIs go, I do miss the ability to construct a A specialization of |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
Currently? Not really, I guess. If you plan to add a large number of constants more, maybe. Are you going to keep it about the same? Just constants for the most used types? Maybe then, just a few submodules would do, though it would make the absolute paths longer: pub mod attrs {
pub const BOUNDARY = Name { "boundary" };
pub const CHARSET = Name { "charset" };
}
// Is having `Name` constants strictly necessary since they can be converted to and from strings at nearly zero cost?
pub mod names {
pub const APPLICATION = Name { "application" };
// ...
pub const MULTIPART = Name { "multipart" };
// ...
pub const GIF = Name { "gif" };
}
pub mod types {
pub const APPLICATION_JSON = Mime { "application/json" };
pub const APPLICATION_OCTET_STREAM = Mime { "application/octet-stream" };
// ...
pub const IMAGE_WILDCARD = Mime { "image/*" };
pub const IMAGE_GIF = Mime { "image/gif" };
// ...
pub const MULTIPART_FORM_DATA = Mime { "multipart/form-data" };
}You could use |
This comment has been minimized.
This comment has been minimized.
Undecided. I'm sure there's a few other fairly common that I have forgotten. I'm not sure I'd want to just copy the IANA registry into this crate. With a macro to make new static
Well, having constants instead of people typing strings does allow the catching of typos.
I did start a macro trying to do just that, but hit 2 problems, 1 probably solvable, another not.
With a compile time macro, they can be concatenated into a single static string, so the there's no runtime cost. And by allowing things like |
abonander
referenced this issue
Aug 23, 2017
Merged
Implement `Error` and `Display` for `FromStrError` and `parse::ParseError` #59
This comment has been minimized.
This comment has been minimized.
|
There was some discussion in #55 about splitting |
This comment has been minimized.
This comment has been minimized.
|
Makes sense. |
This comment has been minimized.
This comment has been minimized.
|
You might also want to consider adding some support for RFC2231. A example from the RFC would be:
By adding a
Additionally they add a mechanism to split long parameter values into multiple Like I said before this crate does parse such definitions just fine, Similar nice would be a way to construct such MIMES, For now I will implement some of the part on top of |
This comment has been minimized.
This comment has been minimized.
KodrAus
commented
Oct 23, 2017
|
One question that's come up during the crate evaluation so far is whether Splitting into |
This comment has been minimized.
This comment has been minimized.
|
Here are some other thinks which I think are a good idea:
|
abonander commentedJun 10, 2017
With Hyper on its way to 1.0, perhaps it's time to start discussing where this crate is at in relation to its own eventual 1.0 release, as well as create a place to document potential blockers for said release. That said, I haven't looked too closely at this crate lately so I don't know what any potential blockers might be.
Thoughts, @seanmonstar?