From e1698065c628b298ed002fee63e7daf03d4cc80d Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Wed, 12 Sep 2018 19:54:46 -0500 Subject: [PATCH] MAINT: more documentation. --- src/combinators.rs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/combinators.rs b/src/combinators.rs index 727f990..fff0c4e 100644 --- a/src/combinators.rs +++ b/src/combinators.rs @@ -724,19 +724,36 @@ pub fn eoi(i: I) -> Result { } } -/// constructs a function named $name that takes an input of type $i and produces an output +/// Constructs a function named $name that takes an input of type $i and produces an output /// of type $o. /// +/// ``` +/// # #[macro_use] extern crate abortable_parser; +/// # use abortable_parser::iter::StrIter; +/// make_fn!(myrule, +/// text_token!("token") +/// ); +/// ``` +/// +/// You can also specify that the function is public if so desired. +/// +/// ``` +/// # #[macro_use] extern crate abortable_parser; +/// # use abortable_parser::iter::StrIter; +/// make_fn!(pub otherrule, +/// text_token!("other") +/// ); +/// ``` #[macro_export] macro_rules! make_fn { ($name:ident<$i:ty, $o:ty>, $rule:ident!($( $body:tt )* )) => { - fn $name(i: $i) -> Result<$i,$o> { + fn $name(i: $i) -> $crate::Result<$i,$o> { $rule!(i, $($body)*) } }; (pub $name:ident<$i:ty, $o:ty>, $rule:ident!($( $body:tt )* )) => { - pub fn $name(i: $i) -> Result<$i,$o> { + pub fn $name(i: $i) -> $crate::Result<$i,$o> { $rule!(i, $($body)*) } };