use core::mem; use poolman::PoolMan; #[derive(Debug)] struct IDrop(u32); impl core::ops::Drop for IDrop { fn drop(&mut self) { println!("drop value: {}", self.0); } } static P: PoolMan<IDrop, 2> = PoolMan::new([IDrop(10), IDrop(11)]); fn main() { P.init(); { let e = P.alloc().unwrap(); println!("e {:?}", *e); mem::drop(e); let mut e1 = P.alloc().unwrap(); println!("e1 {:?}", *e1); *e1 = IDrop(2); println!("e1 {:?}", *e1); let e2 = P.alloc().unwrap(); println!("e2 {:?}", *e2); } let e = P.alloc().unwrap(); println!("e {:?}", *e); }