summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStanislav Tkach <stanislav.tkach@gmail.com>2020-08-21 14:18:06 +0300
committerGitHub <noreply@github.com>2020-08-21 14:18:06 +0300
commitee79b7bb4a3f16818a5ac488fbc95599f5453a2c (patch)
tree658cfa4798cd355fd00527b37e920f2a1d08c5fb /src
parentd3d10d54b18981ba6d530bc027bd409f031b8eb5 (diff)
Implement Clone trait for Options (#455)
Diffstat (limited to 'src')
-rw-r--r--src/db_options.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/db_options.rs b/src/db_options.rs
index 52a4141..73cdf08 100644
--- a/src/db_options.rs
+++ b/src/db_options.rs
@@ -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 {
fn drop(&mut self) {
unsafe {