- assert!(self.is_primitive(&resolved));
- let slice_path = format!("[{}]", resolved);
- if let Some((prefix, suffix)) = path_lookup(&slice_path, true) {
- write!(w, "let mut local_{} = {}{}{};", ident, prefix, var, suffix).unwrap();
- true
- } else { false }
+ if self.is_primitive(&resolved) {
+ let slice_path = format!("[{}]", resolved);
+ if let Some((prefix, suffix)) = path_lookup(&slice_path, true) {
+ write!(w, "let mut local_{} = {}{}{};", ident, prefix, var, suffix).unwrap();
+ true
+ } else { false }
+ } else {
+ let tyref = [&*s.elem];
+ if to_c {
+ // If we're converting from a slice to a Vec, assume we can clone the
+ // elements and clone them into a new Vec first. Next we'll walk the
+ // new Vec here and convert them to C types.
+ write!(w, "let mut local_{}_clone = Vec::new(); local_{}_clone.extend_from_slice({}); let mut {} = local_{}_clone; ", ident, ident, ident, ident, ident).unwrap();
+ }
+ is_ref = false;
+ convert_container!("Vec", 1, || tyref.iter().map(|t| generics.resolve_type(*t)));
+ unimplemented!("convert_container should return true as container_lookup should succeed for slices");
+ }