|
|
@ -162,7 +162,7 @@ impl Environment { |
|
|
|
pub fn stat(&self) -> Result<Stat> { |
|
|
|
pub fn stat(&self) -> Result<Stat> { |
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
|
let mut stat = Stat::new(); |
|
|
|
let mut stat = Stat::new(); |
|
|
|
lmdb_try!(ffi::mdb_env_stat(self.env(), &mut stat.0)); |
|
|
|
lmdb_try!(ffi::mdb_env_stat(self.env(), stat.mdb_stat())); |
|
|
|
Ok(stat) |
|
|
|
Ok(stat) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -247,16 +247,21 @@ impl Environment { |
|
|
|
|
|
|
|
|
|
|
|
/// Environment statistics.
|
|
|
|
/// Environment statistics.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// Contains information about the size and layout of an LMDB environment.
|
|
|
|
/// Contains information about the size and layout of an LMDB environment or database.
|
|
|
|
pub struct Stat(pub(crate) ffi::MDB_stat); |
|
|
|
pub struct Stat(ffi::MDB_stat); |
|
|
|
|
|
|
|
|
|
|
|
impl Stat { |
|
|
|
impl Stat { |
|
|
|
/// Create a new Stat with zero'd inner struct `ffi::MDB_stat`.
|
|
|
|
/// Create a new Stat with zero'd inner struct `ffi::MDB_stat`.
|
|
|
|
pub fn new() -> Stat { |
|
|
|
pub(crate) fn new() -> Stat { |
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
|
Stat(mem::zeroed()) |
|
|
|
Stat(mem::zeroed()) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns a mut pointer to `ffi::MDB_stat`.
|
|
|
|
|
|
|
|
pub(crate) fn mdb_stat(&mut self) -> *mut ffi::MDB_stat { |
|
|
|
|
|
|
|
&mut self.0 |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Stat { |
|
|
|
impl Stat { |
|
|
|