doc(hidden) -> pub(crate)

fixes #17
without.crypto
Dan Burkert 7 years ago
parent d0fda113ca
commit 8e0bdab382
  1. 6
      src/cursor.rs
  2. 9
      src/database.rs
  3. 8
      src/transaction.rs

@ -124,8 +124,7 @@ impl <'txn> RoCursor<'txn> {
/// Creates a new read-only cursor in the given database and transaction. /// Creates a new read-only cursor in the given database and transaction.
/// Prefer using `Transaction::open_cursor`. /// Prefer using `Transaction::open_cursor`.
#[doc(hidden)] pub(crate) fn new<T>(txn: &'txn T, db: Database) -> Result<RoCursor<'txn>> where T: Transaction {
pub fn new<T>(txn: &'txn T, db: Database) -> Result<RoCursor<'txn>> where T: Transaction {
let mut cursor: *mut ffi::MDB_cursor = ptr::null_mut(); let mut cursor: *mut ffi::MDB_cursor = ptr::null_mut();
unsafe { lmdb_result(ffi::mdb_cursor_open(txn.txn(), db.dbi(), &mut cursor))?; } unsafe { lmdb_result(ffi::mdb_cursor_open(txn.txn(), db.dbi(), &mut cursor))?; }
Ok(RoCursor { Ok(RoCursor {
@ -163,8 +162,7 @@ impl <'txn> RwCursor<'txn> {
/// Creates a new read-only cursor in the given database and transaction. /// Creates a new read-only cursor in the given database and transaction.
/// Prefer using `RwTransaction::open_rw_cursor`. /// Prefer using `RwTransaction::open_rw_cursor`.
#[doc(hidden)] pub(crate) fn new<T>(txn: &'txn T, db: Database) -> Result<RwCursor<'txn>> where T: Transaction {
pub fn new<T>(txn: &'txn T, db: Database) -> Result<RwCursor<'txn>> where T: Transaction {
let mut cursor: *mut ffi::MDB_cursor = ptr::null_mut(); let mut cursor: *mut ffi::MDB_cursor = ptr::null_mut();
unsafe { lmdb_result(ffi::mdb_cursor_open(txn.txn(), db.dbi(), &mut cursor))?; } unsafe { lmdb_result(ffi::mdb_cursor_open(txn.txn(), db.dbi(), &mut cursor))?; }
Ok(RwCursor { cursor: cursor, _marker: PhantomData }) Ok(RwCursor { cursor: cursor, _marker: PhantomData })

@ -20,11 +20,10 @@ impl Database {
/// ///
/// Prefer using `Environment::open_db`, `Environment::create_db`, `TransactionExt::open_db`, /// Prefer using `Environment::open_db`, `Environment::create_db`, `TransactionExt::open_db`,
/// or `RwTransaction::create_db`. /// or `RwTransaction::create_db`.
#[doc(hidden)] pub(crate) unsafe fn new(txn: *mut ffi::MDB_txn,
pub unsafe fn new(txn: *mut ffi::MDB_txn, name: Option<&str>,
name: Option<&str>, flags: c_uint)
flags: c_uint) -> Result<Database> {
-> Result<Database> {
let c_name = name.map(|n| CString::new(n).unwrap()); let c_name = name.map(|n| CString::new(n).unwrap());
let name_ptr = if let Some(ref c_name) = c_name { c_name.as_ptr() } else { ptr::null() }; let name_ptr = if let Some(ref c_name) = c_name { c_name.as_ptr() } else { ptr::null() };
let mut dbi: ffi::MDB_dbi = 0; let mut dbi: ffi::MDB_dbi = 0;

@ -126,8 +126,7 @@ impl <'env> RoTransaction<'env> {
/// Creates a new read-only transaction in the given environment. Prefer /// Creates a new read-only transaction in the given environment. Prefer
/// using `Environment::begin_ro_txn`. /// using `Environment::begin_ro_txn`.
#[doc(hidden)] pub(crate) fn new(env: &'env Environment) -> Result<RoTransaction<'env>> {
pub fn new(env: &'env Environment) -> Result<RoTransaction<'env>> {
let mut txn: *mut ffi::MDB_txn = ptr::null_mut(); let mut txn: *mut ffi::MDB_txn = ptr::null_mut();
unsafe { unsafe {
lmdb_result(ffi::mdb_txn_begin(env.env(), ptr::null_mut(), ffi::MDB_RDONLY, &mut txn))?; lmdb_result(ffi::mdb_txn_begin(env.env(), ptr::null_mut(), ffi::MDB_RDONLY, &mut txn))?;
@ -220,8 +219,7 @@ impl <'env> RwTransaction<'env> {
/// Creates a new read-write transaction in the given environment. Prefer /// Creates a new read-write transaction in the given environment. Prefer
/// using `Environment::begin_ro_txn`. /// using `Environment::begin_ro_txn`.
#[doc(hidden)] pub(crate) fn new(env: &'env Environment) -> Result<RwTransaction<'env>> {
pub fn new(env: &'env Environment) -> Result<RwTransaction<'env>> {
let mut txn: *mut ffi::MDB_txn = ptr::null_mut(); let mut txn: *mut ffi::MDB_txn = ptr::null_mut();
unsafe { unsafe {
lmdb_result(ffi::mdb_txn_begin(env.env(), lmdb_result(ffi::mdb_txn_begin(env.env(),
@ -244,7 +242,7 @@ impl <'env> RwTransaction<'env> {
/// ///
/// ## Safety /// ## Safety
/// ///
/// * This function (as well as `Environment::open_db`, /// This function (as well as `Environment::open_db`,
/// `Environment::create_db`, and `Database::open`) **must not** be called /// `Environment::create_db`, and `Database::open`) **must not** be called
/// from multiple concurrent transactions in the same environment. A /// from multiple concurrent transactions in the same environment. A
/// transaction which uses this function must finish (either commit or /// transaction which uses this function must finish (either commit or

Loading…
Cancel
Save