@@ -293,12 +293,22 @@ pub struct UnixTimestamp {
293293 pub sign_is_mandatory : bool ,
294294}
295295
296+ /// Whether trailing input after the declared end is permitted.
297+ #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
298+ pub enum TrailingInput {
299+ /// Trailing input is not permitted and will cause an error.
300+ Prohibit ,
301+ /// Trailing input is permitted but discarded.
302+ Discard ,
303+ }
304+
296305/// The end of input.
297- ///
298- /// There is currently not customization for this modifier.
299306#[ non_exhaustive]
300307#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
301- pub struct End ;
308+ pub struct End {
309+ /// How to handle any input after this component.
310+ pub trailing_input : TrailingInput ,
311+ }
302312
303313/// Generate the provided code if and only if `pub` is present.
304314macro_rules! if_pub {
@@ -432,6 +442,10 @@ impl_const_default! {
432442 precision: UnixTimestampPrecision :: Second ,
433443 sign_is_mandatory: false ,
434444 } ;
435- /// Creates a modifier used to represent the end of input.
436- @pub End => End ;
445+ /// Indicate that any trailing characters after the end of input are prohibited and will cause
446+ /// an error when used with `parse`.
447+ TrailingInput => Self :: Prohibit ;
448+ /// Creates a modifier used to represent the end of input, not allowing any trailing input (i.e.
449+ /// the input must be fully consumed).
450+ @pub End => Self { trailing_input: TrailingInput :: Prohibit } ;
437451}
0 commit comments