-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking issue for str escaping #27791
Comments
@alexcrichton Mind if I take this issue? |
@AnthonyBroadCrawford certainly! The workflow for this would probably look like:
|
The reason given for why they're currently unstable says that they might be rewritten to return a char iterator instead? |
Maybe we can consider the idea of them returning iterators, but those iterators implementing |
@bluss You can already do |
True. With |
🔔 This issue is now entering its final comment period for stabilization 🔔 For now this FCP will be for returning a |
Given that we have I do admit that I find it strange that these methods are in |
As previous, I favour using Display-based interfaces for composability. For example |
@BurntSushi The problem with going through |
@aturon Good point. If others feel good about returning an iterator, then I'm happy with that! |
The libs team discussed this in triage recently and the decision was to punt on this for now. It was brought up that with the exact same name as // signature
fn escape_default(&self) -> EscapeDefault;
As pointed out, just implementing It's also a possibility that we could return one trait implementation and then add the other in a backwards-compatible fashion in the future. While we decide this, however, this is being removed from FCP. |
Just wanted to note that if it's decided that these methods are best implemented as (obviously that'd be a breaking change, but it's something definitely worth considering) |
@clarcharr
Probably we’d deprecate the old methods but not remove them. |
This feature is about three inherent methods of the The libs team discussed this and the consensus was to stabilize, after changing the return type (from @rfcbot fcp merge |
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The agreed API is not just an iterator, but also something that implements Given the noted disadvantages I’m inclined to go with "traditional" dedicated types here. In particular, not being able to name the return type seems significant. |
Yes. Note that @mominul had been reaching out for help on |
Personally, I think that it would be best to make concrete types for now, like the rest of the standard library. At some point, though, it would be nice to be able to soft-deprecate all of the concrete iterator types and replace them with |
For many of the adapters, that will actually need to be quite longer. For |
Err, you're right. It seems that a few trait aliases might come in handy for that. Not sure about |
For most iterator adapters (including Map) that doesn't even work because many impls are conditional on what traits the wrapped iterator implements -- DoubleEndedIterator, ExactSizeIterator, Clone, etc. I also suspect there's problems with variance but that's probably less of a problem in practice. |
As FCP’ed in the tracking issue: rust-lang#27791 (comment)
Stabilize str::escape_* methods with new return types… … that implement `Display` and `Iterator<Item=char>`, as proposed in FCP: #27791 (comment)
Stabilized in #58051. |
As FCP’ed in the tracking issue: rust-lang/rust#27791 (comment)
Stabilize str::escape_* methods with new return types… … that implement `Display` and `Iterator<Item=char>`, as proposed in FCP: rust-lang/rust#27791 (comment)
This is a tracking issue for the unstable
str_escape
feature in the standard library. The open questions I know of here are:char
implementations)I suspect that because the implementations on
char
are stable that we'll also stabilize these.Signatures:
The text was updated successfully, but these errors were encountered: