Fix lifetime issue.

This commit is contained in:
Tom Alexander 2023-07-14 18:04:01 -04:00
parent 4966b02b79
commit b9a7c3f7f3
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 9 additions and 9 deletions

View File

@ -37,9 +37,9 @@ fn plain_text_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s s
recognize(parser_with_context!(any_object_except_plain_text)(context))(input)
}
impl<'x> RematchObject for PlainText<'x> {
impl<'x> RematchObject<'x> for PlainText<'x> {
fn rematch_object<'r, 's>(
&self,
&'x self,
_context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, Object<'s>> {

View File

@ -50,7 +50,7 @@ pub fn radio_link<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s s
#[tracing::instrument(ret, level = "debug")]
pub fn rematch_target<'x, 'r, 's>(
context: Context<'r, 's>,
target: &'x Vec<Object<'s>>,
target: &'x Vec<Object<'x>>,
input: &'s str,
) -> Res<&'s str, Vec<Object<'s>>> {
let mut remaining = input;
@ -104,9 +104,9 @@ fn radio_target_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s
alt((tag("<"), tag(">"), line_ending))(input)
}
pub trait RematchObject {
pub trait RematchObject<'x> {
fn rematch_object<'r, 's>(
&self,
&'x self,
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, Object<'s>>;

View File

@ -244,9 +244,9 @@ fn _text_markup_end<'r, 's, 'x>(
Ok((remaining, source))
}
impl<'x> RematchObject for Bold<'x> {
impl<'x> RematchObject<'x> for Bold<'x> {
fn rematch_object<'r, 's>(
&self,
&'x self,
_context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, Object<'s>> {
@ -262,7 +262,7 @@ fn _rematch_text_markup_object<'r, 's, 'x>(
context: Context<'r, 's>,
input: &'s str,
marker_symbol: &'static str,
original_match_children: &'x Vec<Object<'s>>,
original_match_children: &'x Vec<Object<'x>>,
) -> Res<&'s str, Vec<Object<'s>>> {
let (remaining, _) = pre(context, input)?;
let (remaining, open) = tag(marker_symbol)(remaining)?;
@ -290,5 +290,5 @@ fn _rematch_text_markup_object<'r, 's, 'x>(
let (remaining, _close) = text_markup_end_specialized(context, remaining)?;
let (remaining, _trailing_whitespace) = space0(remaining)?;
Ok((remaining, children))
Ok((remaining, Vec::new()))
}