From 7ec35068c86a546dac8172e74e8a34e3b6813eb2 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 19 Jul 2022 18:19:15 +0200 Subject: Remove a couple of clones --- src/parser.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/parser.rs') diff --git a/src/parser.rs b/src/parser.rs index 3361baf..1e689ee 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -10,8 +10,8 @@ use crate::{Constructs, Options}; /// Importantly, this contains a set of known definitions. /// It also references the input value as [`Code`][]s. #[derive(Debug)] -pub struct ParseState { - pub constructs: Constructs, +pub struct ParseState<'a> { + pub constructs: &'a Constructs, /// List of codes. pub codes: Vec, /// Set of defined identifiers. @@ -21,9 +21,9 @@ pub struct ParseState { /// Turn a string of markdown into events. /// /// Passes the codes back so the compiler can access the source. -pub fn parse(value: &str, options: &Options) -> (Vec, ParseState) { +pub fn parse<'a>(value: &str, options: &'a Options) -> (Vec, ParseState<'a>) { let mut parse_state = ParseState { - constructs: options.constructs.clone(), + constructs: &options.constructs, codes: parse_codes(value), definitions: vec![], }; -- cgit