One thing that I had to dig up from previous #Enarx work was core::marker::PhantomData
. It is not so well known but pretty important concept inside Rust.
PhantomData
is a zero-sized struct that merely acts as a life-time indicator for the other parameter, which are usually pointers on where it is applied. It is used to implement many of the core structs such as Rc
to name one instance.
It is pretty good lesson on how lifetime parameters interact with the Rust compiler.
I’d even say that if you understand PhantomData
, then you have the basic understanding of Rust, and if not, you still have to learn a bit. It is the block that the whole core library is based on after all.