Skip to content

Instantly share code, notes, and snippets.

@aisrael
Created July 1, 2019 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aisrael/057b82479f1896ef34a5e2b2b2f786c0 to your computer and use it in GitHub Desktop.
Save aisrael/057b82479f1896ef34a5e2b2b2f786c0 to your computer and use it in GitHub Desktop.
This shouldn't work according to the docs
pub struct Context<'s>(&'s str);
struct Parser<'c, 's> {
context: &'c Context<'s>,
}
impl<'c, 's> Parser<'c, 's> {
fn parse(&self) -> Result<(), &'s str> {
Err(&self.context.0[1..])
}
}
pub fn parse_context(context: Context) -> Result<(), &str> {
Parser { context: &context }.parse()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment