Skip to content

Instantly share code, notes, and snippets.

View ian-p-cooke's full-sized avatar

Ian P. Cooke ian-p-cooke

View GitHub Profile
@ian-p-cooke
ian-p-cooke / doubles_and_int.rs
Created July 6, 2018 14:14
example of parsers abstracting over multiple nom input types
#[macro_use]
extern crate nom;
use nom::types::{CompleteByteSlice, CompleteStr};
use nom::{digit, recognize_float, space, IResult};
use std::str;
pub trait NomInput<'a, U: nom::AsChar>:
Clone
+ nom::Slice<std::ops::Range<usize>>
@ian-p-cooke
ian-p-cooke / float_record_parser.rs
Last active July 4, 2018 17:38
example parser with nom
#[macro_use]
extern crate nom;
use std::str;
use nom::{digit, recognize_float, space, line_ending, IResult};
use nom::types::CompleteStr;
#[derive(Debug)]
struct FloatRecord {
timestamp: u64,