Skip to content

Commit

Permalink
fix documentation and drop
Browse files Browse the repository at this point in the history
  • Loading branch information
p-avital committed Nov 15, 2023
1 parent 77c00cb commit d05c161
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/zenoh_commons.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
*/
Expand Down
6 changes: 3 additions & 3 deletions src/attachements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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<u8>, Vec<u8>>>(this) })
core::mem::drop(unsafe { core::mem::transmute::<_, HashMap<Cow<[u8]>, Cow<[u8]>>>(this) })
}
}

Expand Down

0 comments on commit d05c161

Please sign in to comment.