home ~ projects ~ socials

Parse An i64 In Rust

asdf

//! ```cargo
//! [dependencies]
//! nom = "7.1.3"
//! ```


use nom::IResult;
use nom::character::complete::i64;

fn main() {
  let alfa = parse("-23").unwrap().1;
  dbg!(alfa);
}

fn parse(source: &str) -> IResult<&str, i64> {
  let (source, result) = i64(source)?;
  Ok((source, result))
}
Output:
[neopolitan_code_run:13] alfa = -23
print("asdf")
Output:
asdf
-- end of line --