chore: implement deref on CommonIndex

This commit is contained in:
qdequele 2019-09-18 18:08:54 +02:00
parent 6ed97d1c19
commit e3c413759f
No known key found for this signature in database
GPG Key ID: B3F0A000EBF11745

View File

@ -1,3 +1,4 @@
use std::ops::Deref;
use serde::de::DeserializeOwned;
use serde::Serialize;
use super::Error;
@ -6,6 +7,14 @@ use std::marker::PhantomData;
#[derive(Clone)]
pub struct CommonIndex(pub crate::CfTree);
impl Deref for CommonIndex {
type Target = crate::CfTree;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl CommonIndex {
pub fn get<T, K>(&self, key: K) -> Result<Option<T>, Error>
where T: DeserializeOwned,