Function bones_framework::prelude::piccolo::io::skip_prefix

pub fn skip_prefix<R>(r: &mut R) -> Result<(), Error>
where R: BufRead,
Expand description

Takes an R: BufRead and:

  • skips the leading UTF-8 BOM if there is one
  • skips the unix shebang if there is one (if the first character is a ā€˜#ā€™, skips everything up until but not including the first ā€˜\nā€™)

This mimics the initial behavior of luaL_loadfile(x). In order to correctly detect and skip the BOM and unix shebang, the internal buffer of the BufRead must be >= 3 bytes.