http icon indicating copy to clipboard operation
http copied to clipboard

Should conversions to StatusCode be implemented on more num types?

Open carllerche opened this issue 7 years ago • 2 comments

Currently, it is only u16. For convenience, it would be nice to implement conversions for other num types: usize, u32, u64.

carllerche avatar Jul 21 '18 03:07 carllerche

The title says to StatusCode, so it this StatusCode::try_from(usize), etc?

I'm -0. I think asking people to realize that a status code is a u16 is useful, and people can convert their number into one themselves. However, I guess it's helpful for things like the response::Builder, so a user who received something like a u32 can just pass it, instead of possibly casting incorrectly.

seanmonstar avatar Oct 18 '18 20:10 seanmonstar

I think it'd be nice to have other number types be able to convert to StatusCode too.

StevenDoesStuffs avatar Aug 10 '19 00:08 StevenDoesStuffs