Skip to content
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

Enable creating SRArray from rust and passing to Swift as arg #59

Open
tleyden opened this issue Jan 21, 2024 · 3 comments
Open

Enable creating SRArray from rust and passing to Swift as arg #59

tleyden opened this issue Jan 21, 2024 · 3 comments

Comments

@tleyden
Copy link

tleyden commented Jan 21, 2024

Is it possible to create an SRArray<SRData> on the rust side and pass it as a parameter to a swift function? Do you have any examples of doing this?

Basically what I'm trying to do is capture a series of screenshots, convert them from CGImage -> SRData, and then pass an array of SRData to a swift function. It can't all be on the swift side though, the rust code needs to collect the array of SRData and then pass it back to the swift side as an array.

rust calls swift to get an `SRData`
rust calls swift to get an `SRData`
..
rust collects `SRData` objects into an SRArray<SRData>  <-- this is the part that is missing 
rust calls swift and passes SRArray<SRData>

Does this sound like the right approach, or would SRObjectArray<CGImage> or defining a custom object be easier?

@tleyden
Copy link
Author

tleyden commented Jan 22, 2024

It seems like this might not be possible yet. From the docs:

Currently, the only types that can be created from Rust are number types, boolean, SRString, and SRData

@Brendonovich
Copy link
Owner

Yea SRArray can't be created from rust yet, should be possible but haven't implemented it yet

@tleyden
Copy link
Author

tleyden commented Jan 23, 2024

@Brendonovich ok thanks for the clarification. I'll change the ticket title to reflect that

@tleyden tleyden changed the title Question on SRArray usage Enable creating SRArray from rust and passing to Swift as arg Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants