Remove hrtb attempt.
This commit is contained in:
parent
b8e3074a0e
commit
a08fab1a8d
@ -31,7 +31,7 @@ pub trait NodeType<'p> {
|
|||||||
|
|
||||||
impl<'p, T> NodeType<'p> for Node<'p, T>
|
impl<'p, T> NodeType<'p> for Node<'p, T>
|
||||||
where
|
where
|
||||||
T: for<'s> ContextElement<'s>,
|
T: ContextElement,
|
||||||
{
|
{
|
||||||
fn get_data<'s>(&'s self) -> &dyn ContextElement {
|
fn get_data<'s>(&'s self) -> &dyn ContextElement {
|
||||||
&self.data
|
&self.data
|
||||||
@ -42,8 +42,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ContextElement<'r> {
|
pub trait ContextElement {
|
||||||
fn get_fail_matcher(&self) -> ChainBehavior<'r>;
|
fn get_fail_matcher<'r>(&'r self) -> ChainBehavior<'r>;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FailMatcherNode<'r> {
|
struct FailMatcherNode<'r> {
|
||||||
@ -60,14 +60,14 @@ pub enum ChainBehavior<'r> {
|
|||||||
IgnoreParent(Option<&'r Matcher>),
|
IgnoreParent(Option<&'r Matcher>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'r> ContextElement<'r> for FailMatcherNode<'r> {
|
impl<'r> ContextElement for FailMatcherNode<'r> {
|
||||||
fn get_fail_matcher(&self) -> ChainBehavior<'r> {
|
fn get_fail_matcher(&self) -> ChainBehavior<'r> {
|
||||||
// TODO: Remove this clone
|
// TODO: Remove this clone
|
||||||
self.fail_matcher.clone()
|
self.fail_matcher.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'r> ContextElement<'r> for PreviousElementNode<'r> {
|
impl<'r> ContextElement for PreviousElementNode<'r> {
|
||||||
fn get_fail_matcher(&self) -> ChainBehavior<'r> {
|
fn get_fail_matcher(&self) -> ChainBehavior<'r> {
|
||||||
ChainBehavior::AndParent(None)
|
ChainBehavior::AndParent(None)
|
||||||
}
|
}
|
||||||
@ -77,10 +77,7 @@ pub struct ContextTree<'r, T> {
|
|||||||
head: Option<Node<'r, T>>,
|
head: Option<Node<'r, T>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'r, T> ContextTree<'r, T>
|
impl<'r, T> ContextTree<'r, T> {
|
||||||
where
|
|
||||||
T: for<'s> ContextElement<'s>,
|
|
||||||
{
|
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
ContextTree { head: None }
|
ContextTree { head: None }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user