From 25570765d727da367d84dc57e55e023a07ad61d8 Mon Sep 17 00:00:00 2001 From: "Philip (a-0)" <@ph:a-0.me> Date: Tue, 13 Feb 2024 18:02:35 +0100 Subject: [PATCH] implemented function mapping `ElementContent`s to their default `ElementUpdateStrategy`. Closes #15 --- ubisync-lib/src/types/element.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ubisync-lib/src/types/element.rs b/ubisync-lib/src/types/element.rs index 7291b7b..7475a10 100644 --- a/ubisync-lib/src/types/element.rs +++ b/ubisync-lib/src/types/element.rs @@ -50,6 +50,14 @@ pub enum ElementUpdateStrategy { Overwrite } +impl ElementUpdateStrategy { + pub fn default_by_content(&self, content: &ElementContent) -> Self { + match content { + _ => Self::Overwrite, + } + } +} + impl Default for ElementUpdateStrategy { fn default() -> Self { Self::Overwrite