May 2019
Intermediate to advanced
698 pages
17h 21m
English
Fundamentally, LinkedList is built just the way we built the doubly linked list in Chapter 14, Lists, Lists, and More Lists, with the addition of a PhantomData<T> type pointer. Why? This is necessary to inform the compiler about the properties of the type that contains the marker when generics are involved. With it, the compiler can determine a range of things, including drop behavior, lifetimes, and so on. The PhantomData<T> pointer is a zero-size addition, and pretends to own type T content, so the compiler can reason about that.
Read now
Unlock full access