Closed kadiwa4 closed 1 year ago
Personally I also use VolatilePtr
in cases where the lifetime is not 'static e.g. the lifetime depends on the lifetime of the mapped memory.
@Freax13 and VolatileRef
doesn't work for that case? I will close the issue then
Accesses to a VolatileRef
happen through a VolatilePtr
returned by VolatileRef::as_ptr
, VolatileRef::as_mut_ptr
or VolatileRef::into_ptr
. All of these functions return a VolatilePtr
with a lifetime which is not static if the lifetime of VolatileRef
isn't also static. In other words removing, the lifetime from VolatilePtr
would also break VolatileRef
.
makes sense
VolatilePtr
is used for memory-mapped I/O where lifetimes are not useful. Also, as a volatile counterpart to*
-pointers, it would make sense if it didn't have a lifetime either.It seems it was added in c3d6b9a8a1692d71a90e2947b11c4c0d24a729b0 to make
map_mut
sound, but that function has been removed again and today'smap
function can easily be used to map from a'static
to another'static
VolatilePtr
. Does it still serve a purpose?