dw2019rust
dw2019rust copied to clipboard
How can I trigger swift function from Rust?
I have one idea about solving. It is creating a bool value in swift and giving its address to Rust. Then setup a timer in swift and check the bool value continuously. When it's time, change value of bool from its address in Rust and it will trigger the function. This scenario could work? How can I solve this problem in efficient way?
Secondly, is there any original type of bitmap in rust? I've seen many crates. Which one do you recommend?
This scenario could work? How can I solve this problem in efficient way?
I don't quite understand the scenario - what does the timer do? I wouldn't recommend having both Swift and Rust accessing the same memory location. Better to pass a bool directly as a normal parameter if you can.
Secondly, is there any original type of bitmap in rust? I've seen many crates. Which one do you recommend?
Not sure, I've looked a few times but never used one in the end.
don't quite understand the scenario - what does the timer do? Sorry, with the timer I will check address of boolean in Swift continuously. When the times up I will change the boolean value from its address in Rust and Swift will be know it.
I wouldn't recommend having both Swift and Rust accessing the same memory location. But giving vector address is a common way to use same memory location. Why do you not recommend it? Because of a possibility accessing at the same time because of the timer? Because bool is a primitive value, I've thought it may not be a problem.