-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
want to specify lifetime bound between 'input
and custom input lifetime 'a
#291
Comments
#270 looks the same. parser!(grammar test_parser<'a>() for StrInput<'a> {
rule parse_slice() -> StrInputSlice<'input> = slice:$([_]*) {
slice
}
}); In my case, the And it seems that the need for adding lifetime bound |
I think I still need a way to make the following code work as expected, so I reopen this issue. rule parse_slice() -> StrInputSlice<'a> = slice:$([_]*) {
slice
} |
'input
and custom input lifetime 'a
While you can probably make this work if you get the lifetimes just right (see #295), the implicitly-added |
Background
I have wrapped
str
withStrInput
andStrInputSlice
myself, and have implParseSlice
forStrInput
, and then I can use$()
symbol to getStrInputSlice
in which way I can get whole inputstr
access. This is very nice, this is also the reason I choserust-peg
overpest
.Problem is here
but for zero-copy reason, I also want to return sliced
str
fromStrInput<'a>
, but I got a life time error for the code below. cuz StringInputSlice is parsed byParseSlice::parse_slice
with a impilict'input
life time so that we can't returnStrInputSlice
with'a
lifetimeThoughts
rust-peg
can add a way we can use'input
lifetime.'input: 'a
or maybe both 😀
The text was updated successfully, but these errors were encountered: