Created
October 23, 2017 17:59
-
-
Save rrichardson/98943359327f5f7bdda6b07b25f08e13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn get<'de, V>(&self, key: &[u8]) -> Result<Option<V>, Error> | |
where | |
V: Deserialize<'de>, | |
{ | |
let res = self.db.get_cf(self.cf, key)?; | |
if let Some(inbuf) = res { | |
let v: V = deserialize(&inbuf[HDR_LEN..]).map_err(Error::from)?; | |
Ok(Some(v)) | |
} else { | |
Ok(None) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment