Update for rustc 1.0.0-nightly (ed530d7a3 2015-01-16 22:41:16 +0000)

without.crypto
Dan Burkert 10 years ago
parent a6a88e76fc
commit 15ac361762
  1. 22
      src/cursor.rs
  2. 3
      src/database.rs
  3. 6
      src/environment.rs
  4. 2
      src/lib.rs
  5. 53
      src/transaction.rs

@ -102,9 +102,7 @@ impl<'txn, T> CursorExt<'txn> for T where T: Cursor<'txn> {}
/// A read-only cursor for navigating the items within a database.
pub struct RoCursor<'txn> {
cursor: *mut ffi::MDB_cursor,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime<'txn>,
_marker: marker::ContravariantLifetime<'txn>,
}
impl <'txn> Cursor<'txn> for RoCursor<'txn> {
@ -113,6 +111,9 @@ impl <'txn> Cursor<'txn> for RoCursor<'txn> {
}
}
impl <'txn> !Sync for RoCursor<'txn> {}
impl <'txn> !Send for RoCursor<'txn> {}
#[unsafe_destructor]
impl <'txn> Drop for RoCursor<'txn> {
fn drop(&mut self) {
@ -130,9 +131,7 @@ impl <'txn> RoCursor<'txn> {
unsafe { try!(lmdb_result(ffi::mdb_cursor_open(txn.txn(), db.dbi(), &mut cursor))); }
Ok(RoCursor {
cursor: cursor,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime::<'txn>,
_marker: marker::ContravariantLifetime::<'txn>,
})
}
}
@ -140,9 +139,7 @@ impl <'txn> RoCursor<'txn> {
/// A read-only cursor for navigating items within a database.
pub struct RwCursor<'txn> {
cursor: *mut ffi::MDB_cursor,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime<'txn>,
_marker: marker::ContravariantLifetime<'txn>,
}
impl <'txn> Cursor<'txn> for RwCursor<'txn> {
@ -151,6 +148,9 @@ impl <'txn> Cursor<'txn> for RwCursor<'txn> {
}
}
impl <'txn> !Sync for RwCursor<'txn> {}
impl <'txn> !Send for RwCursor<'txn> {}
#[unsafe_destructor]
impl <'txn> Drop for RwCursor<'txn> {
fn drop(&mut self) {
@ -168,9 +168,7 @@ impl <'txn> RwCursor<'txn> {
unsafe { try!(lmdb_result(ffi::mdb_cursor_open(txn.txn(), db.dbi(), &mut cursor))); }
Ok(RwCursor {
cursor: cursor,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime::<'txn>,
_marker: marker::ContravariantLifetime::<'txn>,
})
}

@ -40,3 +40,6 @@ impl Database {
self.dbi
}
}
unsafe impl Sync for Database {}
unsafe impl Send for Database {}

@ -20,9 +20,6 @@ pub struct Environment {
dbi_open_mutex: Mutex<()>,
}
unsafe impl Send for Environment {}
unsafe impl Sync for Environment {}
impl Environment {
/// Creates a new builder for specifying options for opening an LMDB environment.
@ -139,6 +136,9 @@ impl Environment {
}
}
unsafe impl Send for Environment {}
unsafe impl Sync for Environment {}
impl Drop for Environment {
fn drop(&mut self) {
unsafe { ffi::mdb_env_close(self.env) }

@ -4,7 +4,7 @@
//! Provides the minimal amount of abstraction necessary to interact with LMDB safely in Rust. In
//! general, the API is very similar to the LMDB [C-API](http://symas.com/mdb/doc/).
#![feature(unsafe_destructor)]
#![feature(unsafe_destructor, optin_builtin_traits)]
#![allow(unstable)]
#[macro_use] extern crate log;

@ -108,11 +108,12 @@ impl<'env, T> TransactionExt<'env> for T where T: Transaction<'env> {}
/// An LMDB read-only transaction.
pub struct RoTransaction<'env> {
txn: *mut ffi::MDB_txn,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime<'env>,
_marker: marker::ContravariantLifetime<'env>,
}
impl <'env> !Sync for RoTransaction<'env> {}
impl <'env> !Send for RoTransaction<'env> {}
#[unsafe_destructor]
impl <'env> Drop for RoTransaction<'env> {
fn drop(&mut self) {
@ -132,12 +133,7 @@ impl <'env> RoTransaction<'env> {
ptr::null_mut(),
ffi::MDB_RDONLY,
&mut txn)));
Ok(RoTransaction {
txn: txn,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime::<'env>,
})
Ok(RoTransaction { txn: txn, _marker: marker::ContravariantLifetime::<'env> })
}
}
@ -157,12 +153,7 @@ impl <'env> RoTransaction<'env> {
mem::forget(self);
ffi::mdb_txn_reset(txn)
};
InactiveTransaction {
txn: txn,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime::<'env>,
}
InactiveTransaction { txn: txn, _marker: marker::ContravariantLifetime::<'env> }
}
}
@ -175,9 +166,7 @@ impl <'env> Transaction<'env> for RoTransaction<'env> {
/// An inactive read-only transaction.
pub struct InactiveTransaction<'env> {
txn: *mut ffi::MDB_txn,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime<'env>,
_marker: marker::ContravariantLifetime<'env>,
}
#[unsafe_destructor]
@ -199,23 +188,19 @@ impl <'env> InactiveTransaction<'env> {
mem::forget(self);
try!(lmdb_result(ffi::mdb_txn_renew(txn)))
};
Ok(RoTransaction {
txn: txn,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime::<'env>,
})
Ok(RoTransaction { txn: txn, _marker: marker::ContravariantLifetime::<'env> })
}
}
/// An LMDB read-write transaction.
pub struct RwTransaction<'env> {
txn: *mut ffi::MDB_txn,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime<'env>,
_marker: marker::ContravariantLifetime<'env>,
}
impl <'env> !Sync for RwTransaction<'env> {}
impl <'env> !Send for RwTransaction<'env> {}
#[unsafe_destructor]
impl <'env> Drop for RwTransaction<'env> {
fn drop(&mut self) {
@ -235,12 +220,7 @@ impl <'env> RwTransaction<'env> {
ptr::null_mut(),
EnvironmentFlags::empty().bits(),
&mut txn)));
Ok(RwTransaction {
txn: txn,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime::<'env>,
})
Ok(RwTransaction { txn: txn, _marker: marker::ContravariantLifetime::<'env> })
}
}
@ -372,12 +352,7 @@ impl <'env> RwTransaction<'env> {
let env: *mut ffi::MDB_env = ffi::mdb_txn_env(self.txn());
ffi::mdb_txn_begin(env, self.txn(), 0, &mut nested);
}
Ok(RwTransaction {
txn: nested,
_no_sync: marker::NoSync,
_no_send: marker::NoSend,
_contravariant: marker::ContravariantLifetime::<'env>,
})
Ok(RwTransaction { txn: nested, _marker: marker::ContravariantLifetime::<'env> })
}
}

Loading…
Cancel
Save