http
http copied to clipboard
Should conversions to StatusCode be implemented on more num types?
Currently, it is only u16. For convenience, it would be nice to implement conversions for other num types: usize, u32, u64.
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.
I think it'd be nice to have other number types be able to convert to StatusCode too.