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