Posted by stmw 9/5/2025
Especially helpful if you come from C / C++
First, Mara changed it to be something much less silly, on Linux and similar it's a Futex, while on Windows it was an SRWLock. However, more recently (last year IIRC) the Windows Mutex is also basically a Futex, albeit Microsoft doesn't call their analogous feature a Futex.
In either case this futex-based design means there's no "inner" pointer, and nothing for it to point to, instead there's some sort of atomic integer type, when we're contended we go to sleep waiting on the integer via futex or similar OS feature.
Edited to add:: Also, the niche trick in the bottom right is somewhat broader than this suggests. If the type doesn't need every bit pattern then Rust might and in some cases is guaranteed to see a niche it can use for this memory optimisation.
Option<&T> is the same size as &T but also Option<NonZeroU16> is the same size as u16, Option<OwnedFd> is the same size as OwnedFd (and thus same size as a C integer by definition), Option<Ordering> is the same size as the Ordering (either of them) and Option<bool> is of course the same size as a bool.
It's like infographics. Pretty visuals, but little to no insight.
both require a `fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>` function
while they work the same semantically it's "convert to string for displaying" and convert to string for debugging" (where debugging could be log messages, or print line debugging etc. by default debug for strings will do string escaping and for structs does print the structure/fields/type name in some semi standard way).
the Formatter is mostly just a string writer/sink, which also exposes a fixed set of formatting options and some utility methods
if a type implements Display through stuff I will skip over you then can also write `instance_of_type.to_string()` and get a string.
This trait are used in the default formatting mechanism used by e.g. `println!()` which other libraries (e.g. log) can use through `format!` and some other more internal/95% of case you don't need to know stuff. E.g. `println!("{a}, {a:?}, {a:#?}")` will in order print the display formatting of a, the debug formatting of a and then the alternative debug formatting (if there is one, else the normal one). And other options like pad left, floating point format options etc. exist too.
Through it should be noted that rust doesn't contain build in serialization, through nearly everything uses the library/traits/types from `serde` for that.
Ironically this does not surprise me on a Rust based website.
Even if it was a reference, the same criticism about left-right scrolling would still apply, at least if you're using the combination of resolution and DPI that people like me do. In fact, if it's meant to be a reference, then it's even more important to make it ergonomic.
But I also don't think the arrangement is that useful.