[librsvg: 12/30] parsers: remove parse_and_validate method




commit 8d5bdef491bb8e4f07dd76c272ed3ba80eb9bea6
Author: Paolo Borelli <pborelli gnome org>
Date:   Wed Dec 23 21:32:35 2020 +0100

    parsers: remove parse_and_validate method

 src/parsers.rs | 22 ----------------------
 1 file changed, 22 deletions(-)
---
diff --git a/src/parsers.rs b/src/parsers.rs
index 509cc9eb..b4d7f455 100644
--- a/src/parsers.rs
+++ b/src/parsers.rs
@@ -45,13 +45,6 @@ pub fn finite_f32(n: f32) -> Result<f32, ValueErrorKind> {
 pub trait ParseValue<T: Parse> {
     /// Parses a `value` string into a type `T`.
     fn parse(&self, value: &str) -> Result<T, ElementError>;
-
-    /// Parses a `value` string into a type `T` with an optional validation function.
-    fn parse_and_validate<F: FnOnce(T) -> Result<T, ValueErrorKind>>(
-        &self,
-        value: &str,
-        validate: F,
-    ) -> Result<T, ElementError>;
 }
 
 impl<T: Parse> ParseValue<T> for QualName {
@@ -61,21 +54,6 @@ impl<T: Parse> ParseValue<T> for QualName {
 
         T::parse(&mut parser).attribute(self.clone())
     }
-
-    fn parse_and_validate<F: FnOnce(T) -> Result<T, ValueErrorKind>>(
-        &self,
-        value: &str,
-        validate: F,
-    ) -> Result<T, ElementError> {
-        let mut input = ParserInput::new(value);
-        let mut parser = Parser::new(&mut input);
-
-        let v = T::parse(&mut parser).attribute(self.clone())?;
-
-        validate(v)
-            .map_err(|e| parser.new_custom_error(e))
-            .attribute(self.clone())
-    }
 }
 
 impl<T: Parse> Parse for Option<T> {


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