pub trait BoundExt<'a>: 'a + Sized {
// Provided method
unsafe fn pre_drop(_me: &mut Bound<'a, Self>) { ... }
}Provided Methods§
Sourceunsafe fn pre_drop(_me: &mut Bound<'a, Self>)
unsafe fn pre_drop(_me: &mut Bound<'a, Self>)
Called when dropping the Bound wrapper before dropping the inner value.
§Safety/Drop
Due to possible specialization of Drop on 'static dropping a “fake”
static value in Self might not be safe at all. This can be handled by
making it non 'sstatic and explicitly dropping it during the Self::drop
call, but then this wrapper migth have been 'static so using the
'static specialization might have been more correct.
This method allows to instead explicitly drop the possible “fake” 'static
value in Self earlier on drop while we still have the correct lifetime.
§Call Safety
This method is only meant to be called when dropping the Bound wrapper,
i.e. immediately before calling Self::drop. Calling anything expect
[Drop::drop][1] after calling BoundExt::pre_drop() is unsafe, so
the caller has to make sure that this won’t happen.
Normally this should only be called by the Bound Drop implementation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.