feat: Remove the Schema to/from_toml/json/bin methods

This commit is contained in:
Clément Renault
2019-09-16 14:48:33 +02:00
parent ffc29a319f
commit 35b7b58ff7
4 changed files with 15 additions and 61 deletions

View File

@ -19,7 +19,7 @@ impl MainIndex {
pub fn schema(&self) -> Result<Option<Schema>, Error> {
match self.0.get(SCHEMA_KEY)? {
Some(bytes) => {
let schema = Schema::read_from_bin(bytes.as_ref())?;
let schema = bincode::deserialize_from(bytes.as_ref())?;
Ok(Some(schema))
},
None => Ok(None),
@ -27,8 +27,7 @@ impl MainIndex {
}
pub fn set_schema(&self, schema: &Schema) -> Result<(), Error> {
let mut bytes = Vec::new();
schema.write_to_bin(&mut bytes)?;
let bytes = bincode::serialize(schema)?;
self.0.insert(SCHEMA_KEY, bytes)?;
Ok(())
}