Rudxain
September 4, 2024, 2:33am
1
Correct me if I'm wrong. I couldn't find the trait when reading std
/core
lib source code.
[T]
has a len
method (which, for some reason, is const
??? how is that even possible?)
Iter
has the field end_or_len
. So it seems the trait could be compatible.
Related: Why doesn't `Vec` implement `ExactSizeIterator` - The Rust Programming Language Forum
jrose
September 4, 2024, 2:37am
2
It’s in the docs , so it must be in the source somewhere.
const
in this context means "callable during compile time".
Rudxain
September 4, 2024, 3:10am
4
That should be documented somewhere. If it isn't, where should I open a PR?
Rudxain
September 4, 2024, 3:12am
5
Rudxain
September 4, 2024, 4:15am
7
I was reading this and I finally understood what it means: Despite ptr::metadata
being const
unstable , there's an attribute that tells the compiler to ignore the instability
Rudxain
September 4, 2024, 4:16am
8
Thanks to everyone who replied! And I'm sorry for the off-topic questions.
This thread can be closed now