I don't see a pointer in your example, though. You can impl Deref and DerefMut, but the object itself has nothing to do with pointers.
It seems to me that what you want is a sort of owned pointer to a possibly stack-allocated object. This reminds of the proposals for &move
owning pointers. However, as far as I understand, the semantics and use cases of &move
are not entirely clear.