Closed milyin closed 2 weeks ago
PR missing one of the required labels: {'enhancement', 'documentation', 'new feature', 'dependencies', 'internal', 'breaking-change', 'bug'}
PR missing one of the required labels: {'documentation', 'dependencies', 'breaking-change', 'enhancement', 'internal', 'new feature', 'bug'}
Fix related to https://github.com/eclipse-zenoh/zenoh/issues/1372
Preparation for further making
z_take
operation forz_loaned_xxx_t*
callback parameters. This will allow user to take ownership of data passed to callback without clone operation. This update is unsafe for C++, as in the zenoh-cpp it's already possible to performstd::move
as soon as the callback parameter is not const. But in this update this is unsafe as on the rust side the non-owned objects are actually passed to callback. I.e. on rust side it's now&mut Sample
represented asz_loaned_sample_t*
. This means that it's prohibited at this moment to convertz_loaned_sample_t*
toz_owned_sample_t*
(which isOption<Sample>
on rust side). But zenoh-cpp is built on assumption that it's safe to do this conversion because until this moment it was not possible to getz_loaned_xxx_t*
reference directly to object other thanz_owned_xxx_t
.The safety correction will be made in separate update to accelerate C++ API updating and to make verifying of safety update easier