Implement Vec<String>
diff --git a/macro/src/expand.rs b/macro/src/expand.rs
index ab1206c..0869c2c 100644
--- a/macro/src/expand.rs
+++ b/macro/src/expand.rs
@@ -260,6 +260,10 @@
None => quote!(::cxx::private::RustString::from_ref(#var)),
Some(_) => quote!(::cxx::private::RustString::from_mut(#var)),
},
+ Type::RustVec(vec) if vec.inner == RustString => match ty.mutability {
+ None => quote!(::cxx::private::RustVec::from_ref_vec_string(#var)),
+ Some(_) => quote!(::cxx::private::RustVec::from_mut_vec_string(#var)),
+ },
Type::RustVec(_) => match ty.mutability {
None => quote!(::cxx::private::RustVec::from_ref(#var)),
Some(_) => quote!(::cxx::private::RustVec::from_mut(#var)),
@@ -332,13 +336,23 @@
Some(quote!(#call.map(|r| r.into_string())))
}
Type::RustBox(_) => Some(quote!(#call.map(|r| ::std::boxed::Box::from_raw(r)))),
- Type::RustVec(_) => Some(quote!(#call.map(|r| r.into_vec()))),
+ Type::RustVec(vec) => {
+ if vec.inner == RustString {
+ Some(quote!(#call.map(|r| r.into_vec_string())))
+ } else {
+ Some(quote!(#call.map(|r| r.into_vec())))
+ }
+ }
Type::UniquePtr(_) => Some(quote!(#call.map(|r| ::cxx::UniquePtr::from_raw(r)))),
Type::Ref(ty) => match &ty.inner {
Type::Ident(ident) if ident == RustString => match ty.mutability {
None => Some(quote!(#call.map(|r| r.as_string()))),
Some(_) => Some(quote!(#call.map(|r| r.as_mut_string()))),
},
+ Type::RustVec(vec) if vec.inner == RustString => match ty.mutability {
+ None => Some(quote!(#call.map(|r| r.as_vec_string()))),
+ Some(_) => Some(quote!(#call.map(|r| r.as_mut_vec_string()))),
+ },
Type::RustVec(_) => match ty.mutability {
None => Some(quote!(#call.map(|r| r.as_vec()))),
Some(_) => Some(quote!(#call.map(|r| r.as_mut_vec()))),
@@ -353,13 +367,23 @@
efn.ret.as_ref().and_then(|ret| match ret {
Type::Ident(ident) if ident == RustString => Some(quote!(#call.into_string())),
Type::RustBox(_) => Some(quote!(::std::boxed::Box::from_raw(#call))),
- Type::RustVec(_) => Some(quote!(#call.into_vec())),
+ Type::RustVec(vec) => {
+ if vec.inner == RustString {
+ Some(quote!(#call.into_vec_string()))
+ } else {
+ Some(quote!(#call.into_vec()))
+ }
+ }
Type::UniquePtr(_) => Some(quote!(::cxx::UniquePtr::from_raw(#call))),
Type::Ref(ty) => match &ty.inner {
Type::Ident(ident) if ident == RustString => match ty.mutability {
None => Some(quote!(#call.as_string())),
Some(_) => Some(quote!(#call.as_mut_string())),
},
+ Type::RustVec(vec) if vec.inner == RustString => match ty.mutability {
+ None => Some(quote!(#call.as_vec_string())),
+ Some(_) => Some(quote!(#call.as_mut_vec_string())),
+ },
Type::RustVec(_) => match ty.mutability {
None => Some(quote!(#call.as_vec())),
Some(_) => Some(quote!(#call.as_mut_vec())),
@@ -508,13 +532,23 @@
quote!(::std::mem::take((*#ident).as_mut_string()))
}
Type::RustBox(_) => quote!(::std::boxed::Box::from_raw(#ident)),
- Type::RustVec(_) => quote!(::std::mem::take((*#ident).as_mut_vec())),
+ Type::RustVec(vec) => {
+ if vec.inner == RustString {
+ quote!(::std::mem::take((*#ident).as_mut_vec_string()))
+ } else {
+ quote!(::std::mem::take((*#ident).as_mut_vec()))
+ }
+ }
Type::UniquePtr(_) => quote!(::cxx::UniquePtr::from_raw(#ident)),
Type::Ref(ty) => match &ty.inner {
Type::Ident(i) if i == RustString => match ty.mutability {
None => quote!(#ident.as_string()),
Some(_) => quote!(#ident.as_mut_string()),
},
+ Type::RustVec(vec) if vec.inner == RustString => match ty.mutability {
+ None => quote!(#ident.as_vec_string()),
+ Some(_) => quote!(#ident.as_mut_vec_string()),
+ },
Type::RustVec(_) => match ty.mutability {
None => quote!(#ident.as_vec()),
Some(_) => quote!(#ident.as_mut_vec()),
@@ -549,13 +583,23 @@
Some(quote!(::cxx::private::RustString::from(#call)))
}
Type::RustBox(_) => Some(quote!(::std::boxed::Box::into_raw(#call))),
- Type::RustVec(_) => Some(quote!(::cxx::private::RustVec::from(#call))),
+ Type::RustVec(vec) => {
+ if vec.inner == RustString {
+ Some(quote!(::cxx::private::RustVec::from_vec_string(#call)))
+ } else {
+ Some(quote!(::cxx::private::RustVec::from(#call)))
+ }
+ }
Type::UniquePtr(_) => Some(quote!(::cxx::UniquePtr::into_raw(#call))),
Type::Ref(ty) => match &ty.inner {
Type::Ident(ident) if ident == RustString => match ty.mutability {
None => Some(quote!(::cxx::private::RustString::from_ref(#call))),
Some(_) => Some(quote!(::cxx::private::RustString::from_mut(#call))),
},
+ Type::RustVec(vec) if vec.inner == RustString => match ty.mutability {
+ None => Some(quote!(::cxx::private::RustVec::from_ref_vec_string(#call))),
+ Some(_) => Some(quote!(::cxx::private::RustVec::from_mut_vec_string(#call))),
+ },
Type::RustVec(_) => match ty.mutability {
None => Some(quote!(::cxx::private::RustVec::from_ref(#call))),
Some(_) => Some(quote!(::cxx::private::RustVec::from_mut(#call))),