feat: Make more functions accessible on the custom settings

This commit is contained in:
Clément Renault 2019-05-24 14:37:04 +02:00
parent 9fca74443e
commit a147c09b06
No known key found for this signature in database
GPG Key ID: 0151CDAB43460DAE

View File

@ -1,20 +1,13 @@
use rocksdb::DBVector;
use std::ops::Deref;
use crate::database::raw_index::InnerRawIndex;
#[derive(Clone)]
pub struct CustomSettings(pub(crate) InnerRawIndex);
impl CustomSettings {
pub fn set<K, V>(&self, key: K, value: V) -> Result<(), rocksdb::Error>
where K: AsRef<[u8]>,
V: AsRef<[u8]>,
{
self.0.set(key, value)
}
impl Deref for CustomSettings {
type Target = InnerRawIndex;
pub fn get<K, V>(&self, key: K) -> Result<Option<DBVector>, rocksdb::Error>
where K: AsRef<[u8]>,
{
self.0.get(key)
fn deref(&self) -> &Self::Target {
&self.0
}
}