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 upTracking issue for TrustedLen (`trusted_len`) #37572
Comments
bluss
added
T-libs
B-unstable
labels
Nov 3, 2016
This comment has been minimized.
This comment has been minimized.
|
Oh, finally this thing is there! I was avoiding |
This comment has been minimized.
This comment has been minimized.
photino
commented
Nov 9, 2016
|
I think it is better named |
This comment has been minimized.
This comment has been minimized.
|
Or perhaps |
This comment has been minimized.
This comment has been minimized.
|
As the referenced code is merged - is this still an issue ? thank you ! |
This comment has been minimized.
This comment has been minimized.
|
Yes, tracking issues keep note on the code while it is still an unstable feature; they are closed when the feature is stabilized or removed. |
This comment has been minimized.
This comment has been minimized.
|
By the way, what is holding stabilization right now? |
This comment has been minimized.
This comment has been minimized.
|
I feel that Any thoughts? |
Mark-Simulacrum
added
the
C-tracking-issue
label
Jul 22, 2017
This comment has been minimized.
This comment has been minimized.
|
Do we need a RFC for stabilization? Also, is TrustedLen meant to be the successor (replacement) of ExactSizeIterator? |
This comment has been minimized.
This comment has been minimized.
|
It serves a different purpose, so I don't think it is a successor. Good start towards stabilization would be to incorporate the naming suggestions from this tracking issue I think. |
This was referenced Jan 30, 2018
This comment has been minimized.
This comment has been minimized.
BatmanAoD
commented
Mar 22, 2018
|
Unless I misunderstand (which is likely), this trait indicates that the number of iterations can be calculated in advance, and that it will be a finite number, possibly greater than max In that case, I would suggest one of
I also considered By the way, what exactly does |
This comment has been minimized.
This comment has been minimized.
|
usize::max_value() |
This comment has been minimized.
This comment has been minimized.
|
The
As currently spec'd, they're complements of each other. Speaking roughly, ExactSizeIterator can be shrunk but not grown, whereas TrustedLen can be grown but not shrunk. (For specific examples, Skip propagates ExactSizeIterator but not TrustedLen, and Chain propagates TrustedLen but not ExactSizeIterator.) |
This comment has been minimized.
This comment has been minimized.
|
The libs team discussed this and the consensus was that, since this trait was introduced in order to specialize on it, it should stay unstable until trait specialization itself becomes closer to stabilization. |
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.
That's not quite true; see the example in #37572 (comment). |
This comment has been minimized.
This comment has been minimized.
Ah. So perhaps eventually. @scottmcm The type doesn't actually mean anything inherently; it's only a refinement on the return value of |
This comment has been minimized.
This comment has been minimized.
|
IMHO we're missing As far as |
Phlosioneer
referenced this issue
Feb 1, 2019
Open
Add `is_empty` function to `ExactSizeIterator` #35428
This comment has been minimized.
This comment has been minimized.
|
I think there are only two things blocking stability for this trait. First, there's questions about what the name should be. Second, we need to improve documentation to make the distinction between this and ExactSizeIterator crystal clear. There are also open questions here about methods that may be included, but they can be handled as separate issues to allow the trait to continue toward stabilization. Here's what is not in question:
I suggest the lang team (or lib team? I get the teams all mixed up) should consider the options presented here and revise the name. Then we can change the name in nightly, and see if there are any comments for a few months. This allows us to make small, steady steps forward. Edit: I spotted the comment #37572 (comment) that said the team wanted to block this until trait specialization is done. I'd still like to make small steps forward, but if they want to hold off then I understand. Sorry for the disruption. |
bluss commentedNov 3, 2016
Implemented in #37306
Open Questions: