Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Parse An i64 In Rust

Code

//! ```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))
}

Results

[neopolitan_code_run:13] alfa = -23

Code

print("asdf")

Results

asdf