[librsvg: 8/10] error: rename NodeError to ElementError



commit 441f74aae43cf08137198f53a37a829ca5d2e18f
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon Mar 16 13:42:35 2020 +0100

    error: rename NodeError to ElementError

 rsvg_internals/src/element.rs    | 10 +++++-----
 rsvg_internals/src/error.rs      | 28 ++++++++++++++--------------
 rsvg_internals/src/parsers.rs    |  8 ++++----
 rsvg_internals/src/properties.rs |  6 +++---
 4 files changed, 26 insertions(+), 26 deletions(-)
---
diff --git a/rsvg_internals/src/element.rs b/rsvg_internals/src/element.rs
index 0ed9b165..bb43f40b 100644
--- a/rsvg_internals/src/element.rs
+++ b/rsvg_internals/src/element.rs
@@ -127,7 +127,7 @@ pub enum ElementType {
 // that come in an element and build up a Vec<ElementError>.  However, we
 // don't do this now.  Doing that may be more useful for an SVG
 // validator, not a renderer like librsvg is.
-pub type ElementResult = Result<(), NodeError>;
+pub type ElementResult = Result<(), ElementError>;
 
 /// Contents of an element node in the DOM
 pub struct Element {
@@ -227,7 +227,7 @@ impl Element {
         }
     }
 
-    fn set_transform_attribute(&mut self, pbag: &PropertyBag<'_>) -> Result<(), NodeError> {
+    fn set_transform_attribute(&mut self, pbag: &PropertyBag<'_>) -> Result<(), ElementError> {
         for (attr, value) in pbag.iter() {
             match attr.expanded() {
                 expanded_name!("", "transform") => {
@@ -249,7 +249,7 @@ impl Element {
         &mut self,
         pbag: &PropertyBag<'_>,
         locale: &Locale,
-    ) -> Result<(), NodeError> {
+    ) -> Result<(), ElementError> {
         let mut cond = self.cond;
 
         for (attr, value) in pbag.iter() {
@@ -283,7 +283,7 @@ impl Element {
     }
 
     /// Hands the pbag to the node's state, to apply the presentation attributes
-    fn set_presentation_attributes(&mut self, pbag: &PropertyBag<'_>) -> Result<(), NodeError> {
+    fn set_presentation_attributes(&mut self, pbag: &PropertyBag<'_>) -> Result<(), ElementError> {
         match self.specified_values.parse_presentation_attributes(pbag) {
             Ok(_) => Ok(()),
             Err(e) => {
@@ -325,7 +325,7 @@ impl Element {
         }
     }
 
-    fn set_error(&mut self, error: NodeError) {
+    fn set_error(&mut self, error: ElementError) {
         rsvg_log!("setting node {} in error: {}", self, error);
         self.result = Err(error);
     }
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index 9c9ac603..9339adba 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -73,12 +73,12 @@ impl<'a> From<BasicParseError<'a>> for ValueErrorKind {
 
 /// A complete error for an attribute and its erroneous value
 #[derive(Debug, Clone, PartialEq)]
-pub struct NodeError {
+pub struct ElementError {
     pub attr: QualName,
     pub err: ValueErrorKind,
 }
 
-impl error::Error for NodeError {
+impl error::Error for ElementError {
     fn description(&self) -> &str {
         match self.err {
             ValueErrorKind::UnknownProperty => "unknown property",
@@ -88,7 +88,7 @@ impl error::Error for NodeError {
     }
 }
 
-impl fmt::Display for NodeError {
+impl fmt::Display for ElementError {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(f, "{:?}: {}", self.attr.expanded(), self.err)
     }
@@ -147,9 +147,9 @@ impl fmt::Display for AcquireError {
     }
 }
 
-/// Helper for converting `Result<O, E>` into `Result<O, NodeError>`
+/// Helper for converting `Result<O, E>` into `Result<O, ElementError>`
 ///
-/// A `NodeError` requires a `QualName` that corresponds to the attribute to which the
+/// A `ElementError` requires a `QualName` that corresponds to the attribute to which the
 /// error refers, plus the actual `ValueErrorKind` that describes the error.  However,
 /// parsing functions for attribute value types will want to return their own kind of
 /// error, instead of `ValueErrorKind`.  If that particular error type has an `impl
@@ -167,21 +167,21 @@ impl fmt::Display for AcquireError {
 /// ```
 ///
 /// The call to `.attribute(attr)` converts the `Result` from `parse_foo()` into a full
-/// `NodeError` with the provided `attr`.
+/// `ElementError` with the provided `attr`.
 pub trait AttributeResultExt<O> {
-    fn attribute(self, attr: QualName) -> Result<O, NodeError>;
+    fn attribute(self, attr: QualName) -> Result<O, ElementError>;
 }
 
 impl<O, E: Into<ValueErrorKind>> AttributeResultExt<O> for Result<O, E> {
-    fn attribute(self, attr: QualName) -> Result<O, NodeError> {
+    fn attribute(self, attr: QualName) -> Result<O, ElementError> {
         self.map_err(|e| e.into())
-            .map_err(|err| NodeError { attr, err })
+            .map_err(|err| ElementError { attr, err })
     }
 }
 
-/// Turns a short-lived `ParseError` into a long-lived `NodeError`
+/// Turns a short-lived `ParseError` into a long-lived `ElementError`
 impl<'i, O> AttributeResultExt<O> for Result<O, ParseError<'i>> {
-    fn attribute(self, attr: QualName) -> Result<O, NodeError> {
+    fn attribute(self, attr: QualName) -> Result<O, ElementError> {
         self.map_err(|e| {
             // FIXME: eventually, here we'll want to preserve the location information
 
@@ -196,13 +196,13 @@ impl<'i, O> AttributeResultExt<O> for Result<O, ParseError<'i>> {
                     tok.to_css(&mut s).unwrap(); // FIXME: what do we do with a fmt::Error?
                     s.push_str("'");
 
-                    NodeError {
+                    ElementError {
                         attr,
                         err: ValueErrorKind::Parse(s),
                     }
                 }
 
-                ParseErrorKind::Basic(BasicParseErrorKind::EndOfInput) => NodeError {
+                ParseErrorKind::Basic(BasicParseErrorKind::EndOfInput) => ElementError {
                     attr,
                     err: ValueErrorKind::parse_error("unexpected end of input"),
                 },
@@ -211,7 +211,7 @@ impl<'i, O> AttributeResultExt<O> for Result<O, ParseError<'i>> {
                     unreachable!("attribute parsers should not return errors for CSS rules")
                 }
 
-                ParseErrorKind::Custom(err) => NodeError { attr, err },
+                ParseErrorKind::Custom(err) => ElementError { attr, err },
             }
         })
     }
diff --git a/rsvg_internals/src/parsers.rs b/rsvg_internals/src/parsers.rs
index 0f8784ee..b64b6d89 100644
--- a/rsvg_internals/src/parsers.rs
+++ b/rsvg_internals/src/parsers.rs
@@ -44,18 +44,18 @@ 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, NodeError>;
+    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, NodeError>;
+    ) -> Result<T, ElementError>;
 }
 
 impl<T: Parse> ParseValue<T> for QualName {
-    fn parse(&self, value: &str) -> Result<T, NodeError> {
+    fn parse(&self, value: &str) -> Result<T, ElementError> {
         let mut input = ParserInput::new(value);
         let mut parser = Parser::new(&mut input);
 
@@ -66,7 +66,7 @@ impl<T: Parse> ParseValue<T> for QualName {
         &self,
         value: &str,
         validate: F,
-    ) -> Result<T, NodeError> {
+    ) -> Result<T, ElementError> {
         let mut input = ParserInput::new(value);
         let mut parser = Parser::new(&mut input);
 
diff --git a/rsvg_internals/src/properties.rs b/rsvg_internals/src/properties.rs
index ac1ff6fc..e13f8c10 100644
--- a/rsvg_internals/src/properties.rs
+++ b/rsvg_internals/src/properties.rs
@@ -536,7 +536,7 @@ impl SpecifiedValues {
         &mut self,
         attr: QualName,
         value: &str,
-    ) -> Result<(), NodeError> {
+    ) -> Result<(), ElementError> {
         let mut input = ParserInput::new(value);
         let mut parser = Parser::new(&mut input);
 
@@ -614,7 +614,7 @@ impl SpecifiedValues {
     pub fn parse_presentation_attributes(
         &mut self,
         pbag: &PropertyBag<'_>,
-    ) -> Result<(), NodeError> {
+    ) -> Result<(), ElementError> {
         for (attr, value) in pbag.iter() {
             match attr.expanded() {
                 expanded_name!(xml "lang") => {
@@ -658,7 +658,7 @@ impl SpecifiedValues {
         &mut self,
         declarations: &str,
         important_styles: &mut HashSet<QualName>,
-    ) -> Result<(), NodeError> {
+    ) -> Result<(), ElementError> {
         let mut input = ParserInput::new(declarations);
         let mut parser = Parser::new(&mut input);
 


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