summaryrefslogtreecommitdiffstats
path: root/libimagref
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-06-09 19:39:17 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-07-04 19:29:02 +0200
commit57e653e384f5c588eb6c512b967b9e3f22ac12a1 (patch)
tree148983bbcefd050665a23c4cc15d601b317d2ba5 /libimagref
parent14cd99f5f2099571bd989c771fd4fc6cd9208176 (diff)
Impl RefFlags::into_toml() as Into<Value> for RefFlags
Diffstat (limited to 'libimagref')
-rw-r--r--libimagref/src/flags.rs21
1 files changed, 14 insertions, 7 deletions
diff --git a/libimagref/src/flags.rs b/libimagref/src/flags.rs
index 1dbbbd3f..17ff9fc7 100644
--- a/libimagref/src/flags.rs
+++ b/libimagref/src/flags.rs
@@ -32,13 +32,6 @@ impl RefFlags {
})
}
- /// 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<Value> {
- unimplemented!()
- }
-
/// Alias for `RefFlags::content_hashing()`
pub fn is_often_moving(mut self, b: bool) -> RefFlags {
self.with_content_hashing(b)
@@ -64,3 +57,17 @@ impl RefFlags {
}
+impl Into<Value> for RefFlags {
+
+ /// Build a TOML::Value from this RefFlags object.
+ ///
+ /// Returns a Map which should be set in `ref.flags` in the header.
+ fn into(self) -> Value {
+ let mut btm = BTreeMap::new();
+ btm.insert(String::from("content_hashing"), Value::Boolean(self.content_hashing));
+ btm.insert(String::from("permission_tracking"), Value::Boolean(self.permission_tracking));
+ return Value::Table(btm)
+ }
+
+}
+