print sink

This commit is contained in:
Geoffroy Couprie 2014-10-27 18:28:54 +01:00
parent 3801066559
commit 607556fdd2
2 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,5 @@
#![feature(macro_rules)]
use nom::{feed, parse, Error, Done, Incomplete};
use nom::{feed, parse, print, Error, Done, Incomplete};
mod nom;
@ -13,4 +13,6 @@ fn main() {
}
feed();
let v2 = "abc";
print(&v2);
}

View File

@ -3,6 +3,8 @@
extern crate collections;
use std::fmt::Show;
type Err = uint;
pub enum Parser<'a,I,O> {
Done(I,O),
@ -55,3 +57,7 @@ pub fn parse<'a>(input: &'a [u8]) -> Parser<'a, &'a [u8], &'a [u8]> {
}
}
pub fn print<'a, T: Show>(input: &'a T) -> Parser<'a, (), ()> {
println!("{}", input);
Done((), ())
}