From 0cdfa876f9ca13be475dfac77b0d37ebb7d45da3 Mon Sep 17 00:00:00 2001 From: KitsuneCafe <10284516+kitsunecafe@users.noreply.github.com> Date: Fri, 2 Feb 2024 20:03:56 -0500 Subject: [PATCH] theme not static --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 31acf88..69c1436 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,14 +19,14 @@ const CODE_BLOCK_RE: Lazy = Lazy::new(|| { .unwrap() }); -pub struct SyntectParser { +pub struct SyntectParser<'a> { syntax_set: SyntaxSet, theme_set: ThemeSet, - theme: &'static str, + theme: &'a str, } -impl SyntectParser { - pub fn new(theme: &'static str) -> Self { +impl<'a> SyntectParser<'a> { + pub fn new(theme: &'a str) -> Self { Self { syntax_set: SyntaxSet::load_defaults_newlines(), theme_set: ThemeSet::load_defaults(), @@ -35,7 +35,7 @@ impl SyntectParser { } } -impl Parse for SyntectParser { +impl<'a> Parse for SyntectParser<'a> { fn parse(&mut self, _path: &str, src: &[u8], dst: &mut Vec) -> std::io::Result<()> { let file = String::from_utf8_lossy(src).to_string(); let result = CODE_BLOCK_RE