Skip to content

Commit

Permalink
update exports
Browse files Browse the repository at this point in the history
  • Loading branch information
oXtxNt9U committed Sep 24, 2024
1 parent 0ccfb6b commit 3e324d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion heed/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub use self::iterator::{
RwRevIter, RwRevPrefix, RwRevRange,
};
pub use self::mdb::error::Error as MdbError;
use self::mdb::ffi::{from_val, into_val};
pub use self::mdb::ffi::{from_val, into_val, MDB_val};
pub use self::mdb::flags::{DatabaseFlags, EnvFlags, PutFlags};
pub use self::reserved_space::ReservedSpace;
pub use self::traits::{BoxedError, BytesDecode, BytesEncode, Comparator, LexicographicComparator};
Expand Down
2 changes: 2 additions & 0 deletions heed/src/mdb/lmdb_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ pub fn reserve_size_val(size: usize) -> ffi::MDB_val {
ffi::MDB_val { mv_size: size, mv_data: ptr::null_mut() }
}

#[allow(missing_docs)]
pub unsafe fn into_val(value: &[u8]) -> ffi::MDB_val {
ffi::MDB_val { mv_data: value.as_ptr() as *mut libc::c_void, mv_size: value.len() }
}

#[allow(missing_docs)]
pub unsafe fn from_val<'a>(value: ffi::MDB_val) -> &'a [u8] {
std::slice::from_raw_parts(value.mv_data as *const u8, value.mv_size)
}

0 comments on commit 3e324d0

Please sign in to comment.