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 upRFC: Statically enforce Unicode in std::fmt #526
Conversation
This comment has been minimized.
This comment has been minimized.
|
cc @SimonSapin |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
I think it’s fine for this trait to be in |
This comment has been minimized.
This comment has been minimized.
|
I seem to remember from way back when I was working on the base64 and hex modules that |
This comment has been minimized.
This comment has been minimized.
|
I'd probably be more in favor of an unsafe function to go from |
This comment has been minimized.
This comment has been minimized.
|
@sfackler Looks like Also, if the char/byte is literal, how does |
Ericson2314
reviewed
Dec 15, 2014
|
|
||
| ```rust | ||
| pub trait Writer { | ||
| fn write_str(&mut self, data: &str) -> Result; |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Ericson2314
Dec 15, 2014
Contributor
Ah ok, thanks. I somehow missed that one looking for other Results.
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin I'd imagine that'd help, but I ran into this like ~1.5 years ago so my memory's a bit rusty :) @alexcrichton Yeah, implementations just transmuting from |
This comment has been minimized.
This comment has been minimized.
|
@sfackler You can always used |
alexcrichton
referenced this pull request
Dec 16, 2014
Merged
std: Stabilize the std::str module #19741
This comment has been minimized.
This comment has been minimized.
Sgeo
commented
Dec 16, 2014
|
Could it be confusing for newcomers for the stdlib to have two traits called Writer? Having to check to see which is in use, etc. |
This comment has been minimized.
This comment has been minimized.
|
@Sgeo I think we more or less have a convention to take advantage of the namespacing provided by modules and not try to duplicate it within names. Rather than have |
nrc
assigned
alexcrichton
Dec 16, 2014
alexcrichton
referenced this pull request
Dec 23, 2014
Closed
Use `into_string()` instead of `to_string()` on string literals #19708
alexcrichton
referenced this pull request
Dec 30, 2014
Merged
Add `-mwin32` flag on Windows targets #19
aturon
referenced this pull request
Dec 30, 2014
Closed
Tracking issue for Unicode enforcement in `std::fmt` (RFC 526) #20352
aturon
merged commit 2bec76d
into
rust-lang:master
Dec 30, 2014
This comment has been minimized.
This comment has been minimized.
|
This RFC, which represents a longstanding request to enforce a strong Unicode convention and appears to have no real downsides, has been accepted. Tracking issue. |
This comment has been minimized.
This comment has been minimized.
|
I notice that in the "after" benchmark, |
alexcrichton commentedDec 15, 2014
Statically enforce that the
std::fmtmodule can only create valid UTF-8 databy removing the arbitrary
writemethod in favor of awrite_strmethod.Rendered