1. 33

  2. 3

    The text only hints at it, but I would highly recommend using std::ptr::NonNull for the raw pointer for multiple reasons: a) it communicates an additional invariant to the user and b) rustc knows that NonNull has an illegal value (NULL) and uses that value as a niche to optimise enums. Especially sizeof(Option<NonNull<c_void>>) == sizeof(*mut c_void).

    1. 2

      This is a great overview for those in the process of learning Rust