Lifetime issue.

This commit is contained in:
Tom Alexander
2023-08-22 22:57:44 -04:00
parent cda49c628c
commit 6d1675fa00
2 changed files with 100 additions and 1 deletions

View File

@@ -1,10 +1,14 @@
use std::ops::RangeBounds;
use nom::Compare;
use nom::InputIter;
use nom::InputLength;
use nom::InputTake;
use nom::InputTakeAtPosition;
use nom::Offset;
use nom::Slice;
#[derive(Debug)]
#[derive(Debug, Copy, Clone)]
pub struct OrgSource<'s> {
full_source: &'s str,
start: usize,
@@ -107,6 +111,91 @@ impl<'s> std::fmt::Display for OrgSource<'s> {
}
}
impl<'s> InputLength for OrgSource<'s> {
fn input_len(&self) -> usize {
todo!()
}
}
impl<'s> InputIter for OrgSource<'s> {
type Item = <&'s str as InputIter>::Item;
type Iter = <&'s str as InputIter>::Iter;
type IterElem = <&'s str as InputIter>::IterElem;
fn iter_indices(&self) -> Self::Iter {
todo!()
}
fn iter_elements(&self) -> Self::IterElem {
todo!()
}
fn position<P>(&self, predicate: P) -> Option<usize>
where
P: Fn(Self::Item) -> bool,
{
todo!()
}
fn slice_index(&self, count: usize) -> Result<usize, nom::Needed> {
todo!()
}
}
impl<'s> Offset for OrgSource<'s> {
fn offset(&self, second: &Self) -> usize {
todo!()
}
}
impl<'s> InputTakeAtPosition for OrgSource<'s> {
type Item = <&'s str as InputTakeAtPosition>::Item;
fn split_at_position<P, E: nom::error::ParseError<Self>>(
&self,
predicate: P,
) -> nom::IResult<Self, Self, E>
where
P: Fn(Self::Item) -> bool,
{
todo!()
}
fn split_at_position1<P, E: nom::error::ParseError<Self>>(
&self,
predicate: P,
e: nom::error::ErrorKind,
) -> nom::IResult<Self, Self, E>
where
P: Fn(Self::Item) -> bool,
{
todo!()
}
fn split_at_position_complete<P, E: nom::error::ParseError<Self>>(
&self,
predicate: P,
) -> nom::IResult<Self, Self, E>
where
P: Fn(Self::Item) -> bool,
{
todo!()
}
fn split_at_position1_complete<P, E: nom::error::ParseError<Self>>(
&self,
predicate: P,
e: nom::error::ErrorKind,
) -> nom::IResult<Self, Self, E>
where
P: Fn(Self::Item) -> bool,
{
todo!()
}
}
#[cfg(test)]
mod tests {
use super::*;