Implement Clone trait for Options (#455)

master
Stanislav Tkach 4 years ago committed by GitHub
parent d3d10d54b1
commit ee79b7bb4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 10
      src/db_options.rs

@ -3,6 +3,7 @@
## [Unreleased] ## [Unreleased]
* Export the `DEFAULT_COLUMN_FAMILY_NAME` constant. * Export the `DEFAULT_COLUMN_FAMILY_NAME` constant.
* Implement `Clone` trait for `Options`.
## 0.14.0 (2020-04-22) ## 0.14.0 (2020-04-22)

@ -328,6 +328,16 @@ impl Drop for Options {
} }
} }
impl Clone for Options {
fn clone(&self) -> Self {
let inner = unsafe { ffi::rocksdb_options_create_copy(self.inner) };
if inner.is_null() {
panic!("Could not copy RocksDB options");
}
Self { inner }
}
}
impl Drop for BlockBasedOptions { impl Drop for BlockBasedOptions {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {

Loading…
Cancel
Save