1 An attempt was made to implement Drop on a trait, which is not allowed: only
2 structs and enums can implement Drop. An example causing this error:
7 impl Drop for MyTrait {
12 A workaround for this problem is to wrap the trait up in a struct, and implement
13 Drop on that. An example is shown below:
17 struct MyWrapper<T: MyTrait> { foo: T }
19 impl <T: MyTrait> Drop for MyWrapper<T> {
25 Alternatively, wrapping trait objects requires something like the following:
30 //or Box<MyTrait>, if you wanted an owned trait object
31 struct MyWrapper<'a> { foo: &'a MyTrait }
33 impl <'a> Drop for MyWrapper<'a> {