- } else if let syn::Type::Slice(_) = &*refty.elem {
- // write_c_type will actually do exactly what we want here, we just need to
- // make it a pointer so that its an option. Note that we cannot always convert
- // the Vec-as-slice (ie non-ref types) containers, so sometimes need to be able
- // to edit it, hence we use *mut here instead of *const.
- if args.len() != 1 { return false; }
- write!(w, "*mut ").unwrap();
- self.write_c_type(w, arg, None, true);
- } else { return false; }
- } else if let syn::Type::Array(a) = arg {
- if let syn::Type::Path(p_arg) = &*a.elem {
- let resolved = self.resolve_path(&p_arg.path, generics);
- if !self.is_primitive(&resolved) { return false; }
- if let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Int(len), .. }) = &a.len {
- if self.c_type_from_path(&format!("[{}; {}]", resolved, len.base10_digits()), is_ref, ptr_for_ref).is_none() { return false; }
- write!(w, "_{}{}", resolved, len.base10_digits()).unwrap();
- write!(mangled_type, "_{}{}", resolved, len.base10_digits()).unwrap();
+ },
+ syn::Type::Reference(refty) => {
+ if let syn::Type::Path(p_arg) = &*refty.elem {
+ write_path!(p_arg, None);
+ } else if let syn::Type::Slice(_) = &*refty.elem {
+ // write_c_type will actually do exactly what we want here, we just need to
+ // make it a pointer so that its an option. Note that we cannot always convert
+ // the Vec-as-slice (ie non-ref types) containers, so sometimes need to be able
+ // to edit it, hence we use *mut here instead of *const.
+ if args.len() != 1 { return false; }
+ write!(w, "*mut ").unwrap();
+ self.write_c_type(w, arg, None, true);