Optimize pointer chain construction
As per the new documentation of extend_from
:
Inserts
addition
(+ its pointer chain) between the head and tail of this pointer chain.
- Head of
self
- Head of
addition
- Tail of
addition
- Tail of
addition
- Tail of
addition
- ...
- Tail of
self
- Tail of
self
- Tail of
self
- ...
The implementation is like this specifically, because this trait is only ever implemented on the "main carrier" of the pointer chain, which means that
addition
doesn't usually have a "tail" (unless, you've set the pointers by yourself, which this consequently also supports). This saves us from iterating the entire pointer chain each time an item is added.
Additionally, this MR combines ExtendableFromConst
and ExtendableFromMut
into ExtendableFrom
again because the p_next
of the addition gets modified even if it is a *const
pointer chain, which was previously looked over.