aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-19 18:19:15 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-19 18:19:15 +0200
commit7ec35068c86a546dac8172e74e8a34e3b6813eb2 (patch)
tree1c709d2f392f9a95bd60ddb0908ab9ed2f2b4242 /src/parser.rs
parent0f20660cb95abd4f407bdafa2c45e01829fa971f (diff)
downloadmarkdown-rs-7ec35068c86a546dac8172e74e8a34e3b6813eb2.tar.gz
markdown-rs-7ec35068c86a546dac8172e74e8a34e3b6813eb2.tar.bz2
markdown-rs-7ec35068c86a546dac8172e74e8a34e3b6813eb2.zip
Remove a couple of clones
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs8
1 files changed, 4 insertions, 4 deletions
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<Code>,
/// 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<Event>, ParseState) {
+pub fn parse<'a>(value: &str, options: &'a Options) -> (Vec<Event>, ParseState<'a>) {
let mut parse_state = ParseState {
- constructs: options.constructs.clone(),
+ constructs: &options.constructs,
codes: parse_codes(value),
definitions: vec![],
};