Remove hrtb attempt.

This commit is contained in:
Tom Alexander 2022-11-27 00:02:57 -05:00
parent b8e3074a0e
commit a08fab1a8d
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 6 additions and 9 deletions

View File

@ -31,7 +31,7 @@ pub trait NodeType<'p> {
impl<'p, T> NodeType<'p> for Node<'p, T>
where
T: for<'s> ContextElement<'s>,
T: ContextElement,
{
fn get_data<'s>(&'s self) -> &dyn ContextElement {
&self.data
@ -42,8 +42,8 @@ where
}
}
pub trait ContextElement<'r> {
fn get_fail_matcher(&self) -> ChainBehavior<'r>;
pub trait ContextElement {
fn get_fail_matcher<'r>(&'r self) -> ChainBehavior<'r>;
}
struct FailMatcherNode<'r> {
@ -60,14 +60,14 @@ pub enum ChainBehavior<'r> {
IgnoreParent(Option<&'r Matcher>),
}
impl<'r> ContextElement<'r> for FailMatcherNode<'r> {
impl<'r> ContextElement for FailMatcherNode<'r> {
fn get_fail_matcher(&self) -> ChainBehavior<'r> {
// TODO: Remove this 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> {
ChainBehavior::AndParent(None)
}
@ -77,10 +77,7 @@ pub struct ContextTree<'r, T> {
head: Option<Node<'r, T>>,
}
impl<'r, T> ContextTree<'r, T>
where
T: for<'s> ContextElement<'s>,
{
impl<'r, T> ContextTree<'r, T> {
pub fn new() -> Self {
ContextTree { head: None }
}