-
Notifications
You must be signed in to change notification settings - Fork 59
Added info_string #102
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
Added info_string #102
Conversation
@botev While you are at it can you also add |
Should be fixed now, I've amended the commit. |
Ahh, that's a different story. I personally like the fact that currently the API hides all the messy-ness allocation and is pretty much defacto safe from Rust perspective. If it is up to me I would not expose this kind of things, as it means that the actor must be aware that he might be messing with allocator space that is not part of the Rust (e.g. malloc vs jemmaloc). It is and why I explicitly copy the string to Rust space. I guess that is more up to you guys really, but I don't feel in favour of such exposure. |
@9prady9 I think it is still useful to keep it around for internal use. There may be some arrayfire functions that require calling this alloc and free. |
@pavanky Do you mean we should expose it to user in rust wrapper ? I didn't understand what did you mean by internal use. |
@9prady9 leave it inside the wrapper, no reason to expose it in rust as far as I can tell. |
@pavanky The reason i asked for clarification is - this addition of |
@pavanky I think a better way would be to put such functions in an internal module and use it in required modules rather than expose this at the wrapper level itself. This new module containing fns that we want internally will not be exposed to the user. |
@9prady9 That sounds reasonable too. |
@botev Would it be possible for you to add such module and move this |
@9prady9 sure that's fine. could you point me out where you want the module to be placed and how should I name it? |
@botev At the same level ( If there is no keyword in rust such as private, lets go with module name |
@9prady9 So one option is to put in Also the |
@botev Sure, util will also do the job. Lets put it in util module. Do you mean the type alias |
Yes, currently this is how it looks:
|
This discussion about DimT made me think about the other type aliases in the project. Most of the modules do this type aliasing. May be we can abstract all the aliases into For this PR, you can declare the alias in the May be in a different PR we can move all type aliases into defines module and use them from there. It will be a tedious and time taking change. I can take care of it but If you want to take care it you can do it in this PR itself. Please let me know if you want to. |
Ok so I think this should be done now. For any case please review the code that I'm not doing anything strange (for instance in |
Sorry for the another request, but can you please replace |
That should have it all fixed |
I've just added the linking and interface bit for
af_info_string
(alsoaf_free_host
andaf_alloc_host
). However, I'm not a 100% sure whether I need to callaf_free_host
and whether I'm doing that correctly, so definitely someone should take a look at that.Following the discussion on the forum here in order to make
Rust
copy the string into rust allocated space I'm usingto_str().to_owned()
rather thaninto_string()
and freeing the arrayfire buffer.