[librsvg: 11/23] Add LanguagetTags::from() to construct it from a vector




commit 0ad432ca488f9f4a3932c66beaa715df05b93ae4
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu May 20 13:18:10 2021 -0500

    Add LanguagetTags::from() to construct it from a vector
    
    Maybe this should be impl From...

 src/cond.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/cond.rs b/src/cond.rs
index 5e38082e..e24d28d0 100644
--- a/src/cond.rs
+++ b/src/cond.rs
@@ -119,6 +119,10 @@ impl LanguageTags {
         Ok(LanguageTags(tags))
     }
 
+    pub fn from(tags: Vec<LanguageTag>) -> LanguageTags {
+        LanguageTags(tags)
+    }
+
     pub fn iter(&self) -> impl Iterator<Item = &LanguageTag> {
         self.0.iter()
     }
@@ -158,7 +162,7 @@ impl SystemLanguage {
             })
             .collect::<Result<Vec<LanguageTag>, _>>()?;
 
-        Ok(SystemLanguage(LanguageTags(attribute_tags)))
+        Ok(SystemLanguage(LanguageTags::from(attribute_tags)))
     }
 
     /// Evaluate a systemLanguage value for conditional processing.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]