A conspiracy!

As I was reading the Rust API documentation for std::vec::Vec, something interesting caught my eye in the Vec struct definition.

pub struct Vec<T, A = Global>
where
A: Allocator,
{ /* private fields */ }

I am looking at you { /* private fields */ } ! “What are you trying to hide from me?” I thought. Was I being sucked into a grand conspiracy? The documentation gives no hints as to what these fields are other than giving us a visual representation of the data structure:

ptr      len  capacity
+--------+--------+--------+
| 0x0123 |      2 |      4 |
+--------+--------+--------+
|
v
Heap   +--------+--------+--------+--------+
|    'a' |    'b' | uninit | uninit |
+--------+--------+---...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help