Make the node type generic.
This commit is contained in:
parent
7a241353b5
commit
e888c0e66f
@ -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<Node<'r>>,
|
||||
head: Option<Node<'r, dyn OrgModeContext<'r>>>,
|
||||
}
|
||||
|
||||
impl<'r> ContextTree<'r> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user