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;
|
use super::text::Res;
|
||||||
|
|
||||||
type Matcher = dyn for<'s> Fn(&'s str) -> IResult<&'s str, &'s str, VerboseError<&'s str>>;
|
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> {
|
pub trait OrgModeContext<'r> {
|
||||||
// todo
|
// todo
|
||||||
@ -25,14 +25,14 @@ pub enum ChainBehavior<'r> {
|
|||||||
IgnoreParent(Option<&'r Matcher>),
|
IgnoreParent(Option<&'r Matcher>),
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Node<'r> {
|
struct Node<'r, T: 'r + ?Sized> {
|
||||||
elem: &'r dyn OrgModeContext<'r>,
|
elem: &'r T,
|
||||||
parent: Link<'r>,
|
parent: Link<'r, T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ContextTree<'r> {
|
struct ContextTree<'r> {
|
||||||
// Not using Link so the ContextTree can own this node
|
// 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> {
|
impl<'r> ContextTree<'r> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user