mirror of
https://gitee.com/openharmony/third_party_rust_nom
synced 2024-11-23 07:29:54 +00:00
print sink
This commit is contained in:
parent
3801066559
commit
607556fdd2
@ -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);
|
||||
}
|
||||
|
@ -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((), ())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user