Mutable push.

This commit is contained in:
Tom Alexander 2022-11-24 14:59:37 -05:00
parent 1487f7d96b
commit f2ddf6451c
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 28 additions and 31 deletions

View File

@ -7,41 +7,38 @@ use nom::error::VerboseError;
use nom::IResult; use nom::IResult;
use nom::Parser; use nom::Parser;
// type ContextReference<'r, T> = Option<ContextLayer<'r, T>>; type Link<T> = Option<Box<Node<T>>>;
// type MatcherRef = dyn for<'s> FnMut(&'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>>;
// pub struct ContextLayer<'r, T> { struct Node<T> {
// data: T, elem: T,
// parent: ContextReference<'r, T>, next: Link<T>,
// } }
// pub struct TestContext<'r, T> { pub struct List<T> {
// head: ContextReference<'r, T>, head: Link<T>,
// } }
// pub struct ContextData<'r> { impl<T> List<T> {
// fail_matcher: ChainBehavior<'r>, pub fn new() -> Self {
// } List { head: None }
}
// impl<'r> TestContext<'r, ContextData<'r>> { pub fn push(&mut self, element: T) {
// pub fn new() -> Self { let new_node = Box::new(Node {
// TestContext { head: None } elem: element,
// } next: self.head.take(),
});
// pub fn with_additional_fail_matcher<'subr>( self.head = Some(new_node);
// &self, }
// additional_fail_matcher: &'subr MatcherRef, }
// ) -> TestContext<'subr, ContextData<'subr>> {
// // TestContext {
// // head: Some(
// // ) struct ContextElement<'r> {
// // } fail_matcher: ChainBehavior<'r>,
// todo!() }
// }
// }
// enum ChainBehavior<'r> { enum ChainBehavior<'r> {
// AndParent(Option<&'r MatcherRef>), AndParent(Option<&'r Matcher>),
// IgnoreParent(Option<&'r MatcherRef>), IgnoreParent(Option<&'r Matcher>),
// } }