core::net: Rename parse_ascii() fns to from_bytes()#117274
core::net: Rename parse_ascii() fns to from_bytes()#117274Turbo87 wants to merge 1 commit intorust-lang:masterfrom
parse_ascii() fns to from_bytes()#117274Conversation
|
r? @cuviper (rustbot has picked a reviewer for you, use r? to override) |
We are operating on u8 (aka. byte) values here. ASCII only allows values from 0-127. This would also be consistent with the naming of `OsStr::from_bytes()`.
470714f to
7783695
Compare
Are any non-ASCII bytes actually accepted
That's an infallible conversion, truly accepting any bytes. Anyway, I think this changes posture enough that it needs to be an API decision, especially given that there's a proposed generalization in play at rust-lang/libs-team#287. @rustbot label -T-libs +T-libs-api |
fair point, I guess... 🤔 |
|
It seems confusing for |
|
When I see "from bytes" I think https://doc.rust-lang.org/std/primitive.u32.html#method.from_ne_bytes, not anything related to parsing. So I think it needs more in the name to clarify the intent of the bytes. |
We are operating on u8 (aka. byte) values here. ASCII only allows values from 0-127.
This would also be consistent with the naming of
OsStr::from_bytes().Related:
FromByteStrtrait with blanket implFromStrlibs-team#287