Struct singleton_trait::Erased [−][src]
pub struct Erased<T> { /* fields omitted */ }Expand description
The Exists struct witnesses the logical ownership of a value of type T while remaining zero-sized. This can be used for ghost proofs of soundness.
Erased
NOTE: drop implementations will never be called, as Exists
Secondly, keep in mind that while ExistsExists<&T> and *mut T or &UnsafeCell<T>
even when T is Singleton, but this could be possible if T is zero-sized.
Implementations
This function constructs a value of Erased
Safety
Constructing this asserts that there is a value of type T which has been leaked, or in which it is guaranteed that the program behaves the same up to observation as if a zero-sized copy of T were being passed.
Maps a function on the inside of the Erased body (existential induction).
Safety
Due to the strictness guarantees, the passed closure must not cause any visible side effects, including side effects caused by owning R
pub unsafe fn map_borrow<'a, R, F: FnOnce(&'a T) -> R>(
&'a self,
_: impl Exists<F>
) -> Erased<R>
pub unsafe fn map_borrow<'a, R, F: FnOnce(&'a T) -> R>(
&'a self,
_: impl Exists<F>
) -> Erased<R>Maps a function on the borrow of the Erased field (existential induction).
Safety
Due to the strictness guarantees, the passed closure must not cause any visible side effects, including side effects caused by owning R
pub unsafe fn map_borrow_mut<'a, R, F: FnOnce(&'a mut T) -> R>(
&'a mut self,
_: impl Exists<F>
) -> Erased<R>
pub unsafe fn map_borrow_mut<'a, R, F: FnOnce(&'a mut T) -> R>(
&'a mut self,
_: impl Exists<F>
) -> Erased<R>Maps a function on the mutable borrow of the Erased field.
Safety
Due to the strictness guarantees, the passed closure must not cause any visible side effects, including side effects caused by owning R