-
Notifications
You must be signed in to change notification settings - Fork 65
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
Adding missing C headers and Swift code for Vec<f32/f64> support #200
Adding missing C headers and Swift code for Vec<f32/f64> support #200
Conversation
@chinedufn I couldn't find any tests for the other primitives Vec support, so I wasn't sure where to add tests (or if they are necessary). Please advise on how you'd like to proceed. |
Thanks! You can find a basic swift-bridge/SwiftRustIntegrationTestRunner/SwiftRustIntegrationTestRunnerTests/VecTests.swift Lines 96 to 116 in c1fd717
|
@@ -121,21 +127,27 @@ fn vec_of_primitive_headers(rust_ty: &str, c_ty: &str) -> String { | |||
|
|||
// __private__OptionU8 ... etc | |||
let option_ty = format!("{}{}", "__private__Option", capatilized_first_letter); | |||
let option_ty_tag = if option_ty == "__private__OptionF64" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can delete these changes and change OptionDouble
to OptionF64
here
typedef struct __private__OptionF64 { double val; bool is_some; } __private__OptionDouble; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I've thought the same, just wasn't sure if there was a reason for them to not be equal. Anyway, will do this change and add the tests. Cheers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!! |
This PR adds support for
Vec<f32>
/Vec<f64>
(it seems it was mostly some C headers and Swift code missing).Rust code would look like:
On Swift side,
Double
andFloat
are nowVectorizable
.