Skip to content

Commit

Permalink
add safety comment to custom_key_cmp_wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
antonilol committed Aug 18, 2024
1 parent 40e3bf8 commit d9b4c8c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions heed/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,12 @@ impl Drop for EnvInner {

/// A helper function that transforms the LMDB types into Rust types (`MDB_val` into slices)
/// and vice versa, the Rust types into C types (`Ordering` into an integer).
///
/// # Safety
///
/// `a` and `b` should both properly aligned, valid for reads and should point to a valid
/// [`MDB_val`][ffi::MDB_val]. An [`MDB_val`][ffi::MDB_val] (consists of a pointer and size) is
/// valid when its pointer (`mv_data`) is valid for reads of `mv_size` bytes and is not null.
unsafe extern "C" fn custom_key_cmp_wrapper<C: Comparator>(
a: *const ffi::MDB_val,
b: *const ffi::MDB_val,
Expand Down

0 comments on commit d9b4c8c

Please sign in to comment.