diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2017-11-11 02:57:18 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2017-11-11 02:57:18 +0100 |
commit | 8013983ba94135494079dc607580985717d8a4d3 (patch) | |
tree | 4dc311d33066f9e4220bc5e850678f80b72def27 | |
parent | 2f1a28a0b5058fea346fbf668a249d04900f5ae1 (diff) |
Make parser::timetype() pub, add documentation about interface
-rw-r--r-- | src/parser.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/parser.rs b/src/parser.rs index f23d244..1b87bc4 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -34,6 +34,14 @@ //! Date = <ExactDate> (<Operator> <AmountExpr>)? //! Iterator = <Date> <Iterspec> ("until" <ExactDate> | <number> "times")? //! +//! # Warning +//! +//! This module is not intended for public use... it is still public, so you can use it, but you +//! should know that these interfaces are considered private and I will not follow semver and +//! update the minor or major semver numbers of the interface of this module changes. +//! +//! Be warned! +//! use nom::{IResult, space, alpha, alphanumeric, digit}; use std::str; @@ -288,8 +296,14 @@ impl Into<timetype::TimeType> for Date { } } - -named!(timetype<TimeType>, alt!( +/// Main entry function for timetype parser +/// +/// # Notice +/// +/// Note that this function returns a parser::TimeType, not a timetype::TimeType. Though, the +/// parser::TimeType can be `Into::into()`ed. +/// +named!(pub timetype<TimeType>, alt!( do_parse!(d: date >> (TimeType::Date(d))) | do_parse!(a: amount_expr >> (TimeType::AmountExpr(a))) )); |