[librsvg: 3/43] Introduce a ParseError enum, temporarily with variants for CssParseError and ValueErrorKind
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 3/43] Introduce a ParseError enum, temporarily with variants for CssParseError and ValueErrorKind
- Date: Sat, 21 Dec 2019 02:29:44 +0000 (UTC)
commit 64e292e223cf4d273f6bbfaf7772a25f29457308
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Dec 19 18:19:04 2019 -0600
Introduce a ParseError enum, temporarily with variants for CssParseError and ValueErrorKind
This will let us convert all parsers gradually to CssParseError, and
eventually rename that to just ParseError.
rsvg_internals/src/error.rs | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index 73aecb46..90c028b2 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -22,6 +22,23 @@ use crate::node::RsvgNode;
/// purpose.
pub type CssParseError<'i> = cssparser::ParseError<'i, ValueErrorKind>;
+pub enum ParseError<'i> {
+ P(CssParseError<'i>),
+ V(ValueErrorKind),
+}
+
+impl<'i> From<CssParseError<'i>> for ParseError<'i> {
+ fn from(p: CssParseError<'i>) -> ParseError {
+ ParseError::P(p)
+ }
+}
+
+impl<'i> From<ValueErrorKind> for ParseError<'i> {
+ fn from (v: ValueErrorKind) -> ParseError<'i> {
+ ParseError::V(v)
+ }
+}
+
/// A simple error which refers to an attribute's value
#[derive(Debug, Clone, PartialEq)]
pub enum ValueErrorKind {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]