From e888c0e66f0fae9ebfcb20d3eda49b38d23995b8 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 26 Nov 2022 21:02:52 -0500 Subject: [PATCH] Make the node type generic. --- src/parser/new_context.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/parser/new_context.rs b/src/parser/new_context.rs index 4e5dc2e7..5c38ecaa 100644 --- a/src/parser/new_context.rs +++ b/src/parser/new_context.rs @@ -6,7 +6,7 @@ use super::text::bold_end; use super::text::Res; type Matcher = dyn for<'s> Fn(&'s str) -> IResult<&'s str, &'s str, VerboseError<&'s str>>; -type Link<'r> = Option<&'r Node<'r>>; +type Link<'r, T> = Option<&'r Node<'r, T>>; pub trait OrgModeContext<'r> { // todo @@ -25,14 +25,14 @@ pub enum ChainBehavior<'r> { IgnoreParent(Option<&'r Matcher>), } -struct Node<'r> { - elem: &'r dyn OrgModeContext<'r>, - parent: Link<'r>, +struct Node<'r, T: 'r + ?Sized> { + elem: &'r T, + parent: Link<'r, T>, } struct ContextTree<'r> { // Not using Link so the ContextTree can own this node - head: Option>, + head: Option>>, } impl<'r> ContextTree<'r> {