[librsvg: 32/43] Convert morphology::Operator to CssParseError
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 32/43] Convert morphology::Operator to CssParseError
- Date: Sat, 21 Dec 2019 02:32:11 +0000 (UTC)
commit 49c3447ebf84a3f23aa434c3aabe8ea7405f1e49
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Dec 20 18:31:50 2019 -0600
Convert morphology::Operator to CssParseError
rsvg_internals/src/filters/morphology.rs | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/rsvg_internals/src/filters/morphology.rs b/rsvg_internals/src/filters/morphology.rs
index a0f9a63a..2b33b70f 100644
--- a/rsvg_internals/src/filters/morphology.rs
+++ b/rsvg_internals/src/filters/morphology.rs
@@ -7,7 +7,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::{NumberOptionalNumber, Parse, ParseValue, ParseValueToParseError};
+use crate::parsers::{NumberOptionalNumber, ParseToParseError, ParseValueToParseError};
use crate::property_bag::PropertyBag;
use crate::rect::IRect;
use crate::surface_utils::{
@@ -52,7 +52,7 @@ impl NodeTrait for FeMorphology {
for (attr, value) in pbag.iter() {
match attr.expanded() {
- expanded_name!(svg "operator") => self.operator = attr.parse(value)?,
+ expanded_name!(svg "operator") => self.operator = attr.parse_to_parse_error(value)?,
expanded_name!(svg "radius") => {
let NumberOptionalNumber(x, y) = attr.parse_to_parse_error_and_validate(
value,
@@ -161,13 +161,12 @@ impl FilterEffect for FeMorphology {
}
}
-impl Parse for Operator {
- fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<Operator, 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,
"erode" => Operator::Erode,
"dilate" => Operator::Dilate,
- )
- .map_err(|_| ValueErrorKind::parse_error("parse error"))
+ )?)
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]