Open jjj-vtm opened 1 month ago
Hey! Thanks for the PR.
I'll have a look at it, but actually there is a big update that I'm about to drop in a branch to start reworking the library to totally hide the C dependencies as the first stage in moving toward a 100% Rust implementation.
The initial update will be to rework the options data structures. At the moment, they contain private FFI elements that are geared toward the C API, with internal cached data like CString
values that are pinned to send to the C lib. These will be replaced by "normal" Rust data structures with public types that are String
, u16
, Duration
, etc.
The existing data structs will remain to perform the actual FFI, but be crate-visible only.
Hopefully this will make things a little nicer.
That sounds great, looking forward to have a look at the branch. If the PR is so to speak included in the next release you can just close it. I was only wondering why from_c_parts was publicly exposed because it is very easy to cause UB from safe rust with this function.
Hi,
I made a (very) small PR to keep the from_c_parts private to the crate. The functions is very unsafe since it is possible to construct MQTTAsync_message from safe rust which will cause UB eg. set payload to point to unitialized memory.
Cheers,
Jan