From 9f5f45aafed42c2f85c7437e503318b5c6e8e729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Mon, 24 Apr 2023 12:28:21 +0200 Subject: [PATCH] interpreter: return Result in read_spec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- src/interpreter.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/interpreter.rs b/src/interpreter.rs index 37679a0..53a7cf6 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -14,7 +14,7 @@ // along with this program. If not, see . use crate::element::ScanElement; -use crate::parsers::parse_spec; +use crate::parsers::{parse_spec, Token}; use crate::types::{Action, Context, Entity, Spec}; use jid::Jid; use minidom::{Element, Error as MinidomError}; @@ -99,10 +99,10 @@ pub fn read_actions<'a>(spec: Spec, context: &'a Context) -> Result(buf: &str) -> Spec { - let mut spec = parse_spec(buf).unwrap(); +pub fn read_spec<'a, 'b>(buf: &str) -> Result { + let mut spec = parse_spec(buf)?; spec.context = bind_context(spec.context.clone()); - spec + Ok(spec) } #[cfg(test)]