Skip to content

Instantly share code, notes, and snippets.

@jchia
Created April 3, 2022 10:38
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 jchia/c2b7e583f964e43b162d801cf0abefe3 to your computer and use it in GitHub Desktop.
Save jchia/c2b7e583f964e43b162d801cf0abefe3 to your computer and use it in GitHub Desktop.
fn magic_parser(i: &[u8]) -> IResult<&[u8], ()> {
ctor::value((), streaming::tag((0x7b5aff5f_u32).to_be_bytes()))(i)
}
fn get_magic(i: &[u8]) -> Result<(), Box<dyn std::error::Error>> {
// `i` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirementrustcE0759
let x = magic_parser(i)?;
Ok(())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment