From d05c161b0ef119b2eafedfa988429a4f2859fcf2 Mon Sep 17 00:00:00 2001 From: Pierre Avital Date: Wed, 15 Nov 2023 14:53:17 +0100 Subject: [PATCH] fix documentation and drop --- include/zenoh_commons.h | 4 ++-- src/attachements.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index b8272e86d..1509401ba 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -184,7 +184,7 @@ typedef struct z_attachement_vtable_t { uintptr_t (*len)(const void*); } z_attachement_vtable_t; /** - * A v-table based map of vector of bool to vector of bool. + * A v-table based map of byte slice to byte slice. * * `vtable == NULL` marks the gravestone value, as this type is often optional. * Users are encouraged to use `z_attachement_null` and `z_attachement_check` to interact. @@ -194,7 +194,7 @@ typedef struct z_attachement_t { const struct z_attachement_vtable_t *vtable; } z_attachement_t; /** - * A map of owned vector of bytes to owned vector of bytes. + * A map of maybe-owned vector of bytes to owned vector of bytes. * * In Zenoh C, this map is backed by Rust's standard HashMap, with a DoS-resistant hasher */ diff --git a/src/attachements.rs b/src/attachements.rs index 9d1083e03..05bdc75ee 100644 --- a/src/attachements.rs +++ b/src/attachements.rs @@ -33,7 +33,7 @@ pub struct z_attachement_vtable_t { len: extern "C" fn(*const c_void) -> usize, } -/// A v-table based map of vector of bool to vector of bool. +/// A v-table based map of byte slice to byte slice. /// /// `vtable == NULL` marks the gravestone value, as this type is often optional. /// Users are encouraged to use `z_attachement_null` and `z_attachement_check` to interact. @@ -79,7 +79,7 @@ pub extern "C" fn z_attachement_len(this: z_attachement_t) -> usize { (this.vtable.unwrap().len)(this.data) } -/// A map of owned vector of bytes to owned vector of bytes. +/// A map of maybe-owned vector of bytes to owned vector of bytes. /// /// In Zenoh C, this map is backed by Rust's standard HashMap, with a DoS-resistant hasher #[repr(C)] @@ -118,7 +118,7 @@ pub extern "C" fn z_bytes_map_check(this: &z_owned_bytes_map_t) -> bool { pub extern "C" fn z_bytes_map_drop(this: &mut z_owned_bytes_map_t) { let this = core::mem::replace(this, z_bytes_map_null()); if z_bytes_map_check(&this) { - core::mem::drop(unsafe { core::mem::transmute::<_, HashMap, Vec>>(this) }) + core::mem::drop(unsafe { core::mem::transmute::<_, HashMap, Cow<[u8]>>>(this) }) } }