diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c91e88..caec758 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] * Export the `DEFAULT_COLUMN_FAMILY_NAME` constant. +* Implement `Clone` trait for `Options`. ## 0.14.0 (2020-04-22) 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 {