- for idx in 0..types.len() {
- writeln!(w, "\t\t\t{}: Clone::clone(&self.{}),", ('a' as u8 + idx as u8) as char, ('a' as u8 + idx as u8) as char).unwrap();
+ for (idx, ty) in types.iter().enumerate() {
+ if ty.starts_with("&'static ") {
+ // Assume blindly the type is opaque. If its not we'll fail to build.
+ // Really we should never have derived structs with a reference type.
+ write!(w, "\t\t\t{}: {} {{ inner: self.{}.inner, is_owned: false}},", ('a' as u8 + idx as u8) as char, &ty[9..], ('a' as u8 + idx as u8) as char).unwrap();
+ } else{
+ writeln!(w, "\t\t\t{}: Clone::clone(&self.{}),", ('a' as u8 + idx as u8) as char, ('a' as u8 + idx as u8) as char).unwrap();
+ }