[librsvg: 13/18] NodeError::new() - renamed from ::attribute_error()



commit 2959f77ffb8b612070632f58eecda5a54309eb59
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Dec 6 18:09:09 2019 -0600

    NodeError::new() - renamed from ::attribute_error()

 rsvg_internals/src/error.rs   | 10 +++++-----
 rsvg_internals/src/node.rs    |  2 +-
 rsvg_internals/src/parsers.rs |  4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index 829eb3da..2e25f0b0 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -51,6 +51,10 @@ pub struct NodeError {
 }
 
 impl NodeError {
+    pub fn new(attr: QualName, error: ValueErrorKind) -> NodeError {
+        NodeError { attr, err: error }
+    }
+
     pub fn parse_error(attr: QualName, error: ParseError) -> NodeError {
         NodeError {
             attr,
@@ -64,10 +68,6 @@ impl NodeError {
             err: ValueErrorKind::Value(description.to_string()),
         }
     }
-
-    pub fn attribute_error(attr: QualName, error: ValueErrorKind) -> NodeError {
-        NodeError { attr, err: error }
-    }
 }
 
 impl error::Error for NodeError {
@@ -177,7 +177,7 @@ pub trait AttributeResultExt<O, E> {
 impl<O, E: Into<ValueErrorKind>> AttributeResultExt<O, E> for Result<O, E> {
     fn attribute(self, attr: QualName) -> Result<O, NodeError> {
         self.map_err(|e| e.into())
-            .map_err(|e| NodeError::attribute_error(attr, e))
+            .map_err(|e| NodeError::new(attr, e))
     }
 }
 
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index fd94dd59..e412f0d0 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -181,7 +181,7 @@ impl NodeData {
 
             parse()
                 .map(|c| self.cond = c)
-                .map_err(|e| NodeError::attribute_error(attr, e))?;
+                .map_err(|e| NodeError::new(attr, e))?;
         }
 
         Ok(())
diff --git a/rsvg_internals/src/parsers.rs b/rsvg_internals/src/parsers.rs
index 9f5577a9..7c766161 100644
--- a/rsvg_internals/src/parsers.rs
+++ b/rsvg_internals/src/parsers.rs
@@ -100,7 +100,7 @@ impl<T: Parse> ParseValue<T> for QualName {
         let mut input = ParserInput::new(value);
         let mut parser = Parser::new(&mut input);
 
-        T::parse(&mut parser).map_err(|e| NodeError::attribute_error(self.clone(), e))
+        T::parse(&mut parser).map_err(|e| NodeError::new(self.clone(), e))
     }
 
     fn parse_and_validate<F: FnOnce(T) -> Result<T, ValueErrorKind>>(
@@ -113,7 +113,7 @@ impl<T: Parse> ParseValue<T> for QualName {
 
         T::parse(&mut parser)
             .and_then(validate)
-            .map_err(|e| NodeError::attribute_error(self.clone(), e))
+            .map_err(|e| NodeError::new(self.clone(), e))
     }
 }
 


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