From c5519da01159023c236c3bc1db64141738ea3b20 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 26 Jun 2019 20:23:25 +0200 Subject: [PATCH] Tagable should not be implemented for Value Oh my dear, what was I thinking? Signed-off-by: Matthias Beyer --- lib/entry/libimagentrytag/src/tagable.rs | 34 +++--------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/lib/entry/libimagentrytag/src/tagable.rs b/lib/entry/libimagentrytag/src/tagable.rs index c96c8098..c76d6512 100644 --- a/lib/entry/libimagentrytag/src/tagable.rs +++ b/lib/entry/libimagentrytag/src/tagable.rs @@ -31,8 +31,6 @@ use failure::Fallible as Result; use crate::tag::{Tag, TagSlice}; use crate::tag::is_tag_str; -use toml::Value; - pub trait Tagable { fn get_tags(&self) -> Result>; @@ -56,10 +54,11 @@ impl<'a> Partial<'a> for TagHeader { type Output = Self; } -impl Tagable for Value { +impl Tagable for Entry { fn get_tags(&self) -> Result> { - self.read_partial::()? + self.get_header() + .read_partial::()? .map(|header| { let _ = header.values .iter() @@ -114,33 +113,6 @@ impl Tagable for Value { tags.iter().map(|t| self.has_tag(t)).fold(Ok(true), |a, e| a.and_then(|b| Ok(b && e?))) } -} - -impl Tagable for Entry { - - fn get_tags(&self) -> Result> { - self.get_header().get_tags() - } - - fn set_tags(&mut self, ts: &[Tag]) -> Result<()> { - self.get_header_mut().set_tags(ts) - } - - fn add_tag(&mut self, t: Tag) -> Result<()> { - self.get_header_mut().add_tag(t) - } - - fn remove_tag(&mut self, t: Tag) -> Result<()> { - self.get_header_mut().remove_tag(t) - } - - fn has_tag(&self, t: TagSlice) -> Result { - self.get_header().has_tag(t) - } - - fn has_tags(&self, ts: &[Tag]) -> Result { - self.get_header().has_tags(ts) - } }