From ae1eb65ec69746ad1315e2421c55132f1b0f7a6e Mon Sep 17 00:00:00 2001 From: Eduardo Barreto Alexandre Date: Sun, 11 Oct 2020 20:12:00 -0300 Subject: [PATCH] Changes cache functions to accept a cache by reference --- src/options.rs | 2 +- src/table.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/options.rs b/src/options.rs index cc14ec2..693537e 100644 --- a/src/options.rs +++ b/src/options.rs @@ -2219,7 +2219,7 @@ impl DBOptions { /// Not supported in ROCKSDB_LITE mode! /// /// Rust: will move in and use share_ptr - pub fn row_cache(self, val: Option) -> Self { + pub fn row_cache(self, val: Option<&Cache>) -> Self { unsafe { if let Some(cache) = val { ll::rocks_dboptions_set_row_cache(self.raw, cache.raw()); diff --git a/src/table.rs b/src/table.rs index 0a273f4..709c035 100644 --- a/src/table.rs +++ b/src/table.rs @@ -166,7 +166,7 @@ impl BlockBasedTableOptions { /// If non-NULL use the specified cache for blocks. /// /// If NULL, rocksdb will automatically create and use an 8MB internal cache. - pub fn block_cache(self, val: Option) -> Self { + pub fn block_cache(self, val: Option<&Cache>) -> Self { unsafe { let ptr = val.map(|c| c.raw()).unwrap_or_else(ptr::null_mut); ll::rocks_block_based_table_options_set_block_cache(self.raw, ptr); @@ -189,7 +189,7 @@ impl BlockBasedTableOptions { /// If non-NULL use the specified cache for compressed blocks. /// /// If NULL, rocksdb will not use a compressed block cache. - pub fn block_cache_compressed(self, val: Option) -> Self { + pub fn block_cache_compressed(self, val: Option<&Cache>) -> Self { unsafe { let ptr = val.map(|c| c.raw()).unwrap_or_else(ptr::null_mut); ll::rocks_block_based_table_options_set_block_cache_compressed(self.raw, ptr);