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

Use MaybeUninit for newly allocated samples #1

Closed
elBoberido opened this issue Sep 16, 2021 · 5 comments · Fixed by #34
Closed

Use MaybeUninit for newly allocated samples #1

elBoberido opened this issue Sep 16, 2021 · 5 comments · Fixed by #34
Labels
enhancement New feature or request

Comments

@elBoberido
Copy link
Member

Since the data of the samples is not initialized, this should be reflected by the type system with MaybeUninit. The user then either has to use assume_init before sending the sample or it might be done under the hood. Alternatively MaybeUninit<T> could be transmuted to T.

@elBoberido elBoberido added the enhancement New feature or request label Sep 16, 2021
@neilisaac
Copy link

Exposing &mut [u8] is also nice for compatibility with the bytes::BufMut trait.

For my use case I decided to build a fairly thin rust interface on top of the C bindings and am fairly happy with that approach so far. Happy to compare notes if you’re interested.

@elBoberido
Copy link
Member Author

@neilisaac sorry for the late response. I was quite busy with the iceoryx v2 release.

Good idea. I'll add this to the API.

Did you use the current API? If yes, how does it feel? Would be great to get some feedback.

@neilisaac
Copy link

@elBoberido I found the C API fairly easy to use to build RAII abstractions for each entity. I built bindings for all C methods exposed but haven't integrated it with a production codebase (yet). To avoid adding noise to this issue, here's an example use of my rust bindings. I'm happy to chat if you're interested in comparing notes about the two approaches for rust support.

@elBoberido
Copy link
Member Author

@neilisaac would be great. We have a bi-weekly developer meetup which could be used for discussion but we can also do it on gitter or github discussions.

My initial idea was to use the untyped C++ API and then try to replace part of the runtime with native Rust code. Maybe it is more pragmatic to just use the C API and create a nice Rust API around it.

I have to think about the Listener though. It spawns internally a thread and I'm not quite sure if it is easy to create a safe abstraction around this construct.

That said, would be great to get some input and/or code from you.

@neilisaac
Copy link

I posted some more details in this discussion: eclipse-iceoryx/iceoryx#1304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants