pub fn impl_assume_accessed_via_extract_self<T: PessimizeCast>(
self_: &mut T,
extract_self: impl FnOnce(&mut T) -> T,
)Expand description
Implementation of BorrowPessimize::assume_accessed_impl for types where
there is a cheap way to extract the inner T from an &mut T
For Copy types, this is a dereference, and for Default types where the
default value is truly trivial and guaranteed to be optimized out (like
Vec), this is core::mem::take.
The Drop impl of the value left in self_ by extract_self will not be
called, make sure that this does not result in a resource leak.