pub trait DropWithOwnedFields: DestructureFields {
// Required method
fn drop(owned_fields: DestructuredFieldsOf<Self>);
}
Expand description
The whole objective of this crate: to allow one to write an impl Drop
-looking block, but
with owned access to the fields.
That is, an impl Drop
-looking block, but wherein the argument to that function is “a
destructuring Self { fields… }
pattern” rather than the usual, severely limited, &mut self
.
This trait:
- can only be implemented on a [
#[drop_with_owned_fields]
]-annotated type, - at which point it even has to be implemented on such a type (since the actual
impl Drop
produced by the macro attribute requires it so as to delegate to it).
See the main crate
docs for more info.
Required Methods§
fn drop(owned_fields: DestructuredFieldsOf<Self>)
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.