-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to pass Vec<String> or &[String] #367
Comments
There is no predefined type conversations for this. One way to handle this is: type VecOfStrings = Vec<String>;
foreign_class!(
class VecOfStrings {
self_type VecOfStrings;
constructor default() -> VecOfStrings {
Vec::<String>::default()
}
fn at(&self, i: usize) -> &str {
this[i].as_str()
}
}
);
fn test(s: &Vec<String>) {
unimplemented!()
}
foreign_class!(
class WorkWithStrings {
fn test(s : &VecOfStrings);
}
); |
Thank you for your reply. It's very useful. |
is there a plan to implement this? quite common scenario to have this type of param... |
I was about to raise another issue for the same, and I have the same question. |
No specific plans for this. I my practice I need it twice, one time I use work around mentioned here, other time I wrote rule to convert
For now for C++ there are support of Vec of "primitive type" (can be generalized to any |
|
flapigen can works with generic rules, for now there are two generic rules for slices:
and
So if somebody add the third rule, without any trait contrait |
I want to expose a this-like function to cpp. But id can't.
The text was updated successfully, but these errors were encountered: