From d9d17c276312f7606acd13570a64a988e14e2f6d Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Fri, 13 Sep 2024 10:31:11 +0200 Subject: [PATCH] say in the docs that creating more than using more than one bytes_writer is undefined behaviour --- include/zenoh_commons.h | 3 ++- src/payload.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 22716f38a..7a7357fb2 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -1610,7 +1610,8 @@ ZENOHC_API struct z_bytes_reader_t z_bytes_get_reader(const struct z_loaned_byte ZENOHC_API struct z_bytes_slice_iterator_t z_bytes_get_slice_iterator(const struct z_loaned_bytes_t *this_); /** - * Gets writer for `this_`. + * @brief Gets writer for`this_`. + * @note Creating another writer while previous one is still in use is undefined behaviour. */ ZENOHC_API struct z_bytes_writer_t z_bytes_get_writer(struct z_loaned_bytes_t *this_); /** diff --git a/src/payload.rs b/src/payload.rs index bbd4b254a..1fd11eae5 100644 --- a/src/payload.rs +++ b/src/payload.rs @@ -945,7 +945,8 @@ pub use crate::opaque_types::z_bytes_writer_t; decl_c_type! {loaned(z_bytes_writer_t, ZBytesWriter<'static>)} -/// Gets writer for `this_`. +/// @brief Gets writer for`this_`. +/// @note Creating another writer while previous one is still in use is undefined behaviour. #[no_mangle] extern "C" fn z_bytes_get_writer(this: &'static mut z_loaned_bytes_t) -> z_bytes_writer_t { *this.as_rust_type_mut().writer().as_loaned_c_type_ref()