From f6ff7752493d1e6c032ba57c46cde143ac916e50 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 9 Jun 2016 16:49:46 +0200 Subject: [PATCH] Add concept of RefFlags --- libimagref/src/flags.rs | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 libimagref/src/flags.rs diff --git a/libimagref/src/flags.rs b/libimagref/src/flags.rs new file mode 100644 index 00000000..9d7a1a3b --- /dev/null +++ b/libimagref/src/flags.rs @@ -0,0 +1,55 @@ +use std::collections::BTreeMap; + +use toml::Value; + +use error::RefErrorKind as REK; +use result::Result; + +#[derive(Default)] +pub struct RefFlags { + content_hashing: bool, + permission_tracking: bool, +} + +impl RefFlags { + + /// Read the RefFlags from a TOML document + /// + /// Assumes that the whole TOML tree is passed. So this looks up `ref.flags` to get the flags. + /// It assumes that this is a Map with Key = and Value = boolean. + pub fn read(v: &Value) -> Result { + unimplemented!() + } + + /// Build a TOML::Value from this RefFlags object. + /// + /// Returns a Map which should be set in `ref.flags` in the header. + pub fn into_toml(self) -> Result { + unimplemented!() + } + + /// Alias for `RefFlags::content_hashing()` + pub fn is_often_moving(mut self, b: bool) -> RefFlags { + self.with_content_hashing(b) + } + + pub fn with_content_hashing(self, b: bool) -> RefFlags { + unimplemented!() + } + + pub fn with_permission_tracking(mut self, b: bool) -> RefFlags { + self.permission_tracking = b; + self + } + + + pub fn get_content_hashing(&self) -> bool { + unimplemented!() + } + + pub fn get_permission_tracking(&self) -> bool { + unimplemented!() + } + +} +