[librsvg: 31/43] Convert composite::Operator to CssParseError
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 31/43] Convert composite::Operator to CssParseError
- Date: Sat, 21 Dec 2019 02:32:06 +0000 (UTC)
commit ae03cf437e1afde10c08f1288ac84bc1542763c1
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Dec 20 18:30:54 2019 -0600
Convert composite::Operator to CssParseError
rsvg_internals/src/filters/composite.rs | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/rsvg_internals/src/filters/composite.rs b/rsvg_internals/src/filters/composite.rs
index 095bc584..13d649ac 100644
--- a/rsvg_internals/src/filters/composite.rs
+++ b/rsvg_internals/src/filters/composite.rs
@@ -5,7 +5,7 @@ use markup5ever::{expanded_name, local_name, namespace_url, ns};
use crate::drawing_ctx::DrawingCtx;
use crate::error::*;
use crate::node::{NodeResult, NodeTrait, RsvgNode};
-use crate::parsers::{Parse, ParseValue, ParseValueToParseError};
+use crate::parsers::{ParseToParseError, ParseValueToParseError};
use crate::property_bag::PropertyBag;
use crate::rect::IRect;
use crate::surface_utils::{
@@ -67,11 +67,11 @@ impl NodeTrait for FeComposite {
for (attr, value) in pbag.iter() {
match attr.expanded() {
expanded_name!(svg "in2") => self.in2 = Some(attr.parse_to_parse_error(value)?),
- expanded_name!(svg "operator") => self.operator = attr.parse(value)?,
- expanded_name!(svg "k1") => self.k1 = attr.parse(value)?,
- expanded_name!(svg "k2") => self.k2 = attr.parse(value)?,
- expanded_name!(svg "k3") => self.k3 = attr.parse(value)?,
- expanded_name!(svg "k4") => self.k4 = attr.parse(value)?,
+ expanded_name!(svg "operator") => self.operator = attr.parse_to_parse_error(value)?,
+ expanded_name!(svg "k1") => self.k1 = attr.parse_to_parse_error(value)?,
+ expanded_name!(svg "k2") => self.k2 = attr.parse_to_parse_error(value)?,
+ expanded_name!(svg "k3") => self.k3 = attr.parse_to_parse_error(value)?,
+ expanded_name!(svg "k4") => self.k4 = attr.parse_to_parse_error(value)?,
_ => (),
}
}
@@ -211,9 +211,9 @@ impl FilterEffect for FeComposite {
}
}
-impl Parse for Operator {
- fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ValueErrorKind> {
- parse_identifiers!(
+impl ParseToParseError for Operator {
+ fn parse_to_parse_error<'i>(parser: &mut Parser<'i, '_>) -> Result<Self, CssParseError<'i>> {
+ Ok(parse_identifiers!(
parser,
"over" => Operator::Over,
"in" => Operator::In,
@@ -221,7 +221,7 @@ impl Parse for Operator {
"atop" => Operator::Atop,
"xor" => Operator::Xor,
"arithmetic" => Operator::Arithmetic,
- ).map_err(|_| ValueErrorKind::parse_error("parse error"))
+ )?)
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]