chrono::format

Function parse_and_remainder

Source
pub fn parse_and_remainder<'a, 'b, I, B>(
    parsed: &mut Parsed,
    s: &'b str,
    items: I,
) -> ParseResult<&'b str>
where I: Iterator<Item = B>, B: Borrow<Item<'a>>,
Expand description

Tries to parse given string into parsed with given formatting items. Returns Ok with a slice of the unparsed remainder.

This particular date and time parser is:

  • Greedy. It will consume the longest possible prefix. For example, April is always consumed entirely when the long month name is requested; it equally accepts Apr, but prefers the longer prefix in this case.

  • Padding-agnostic (for numeric items). The Pad field is completely ignored, so one can prepend any number of zeroes before numbers.

  • (Still) obeying the intrinsic parsing width. This allows, for example, parsing HHMMSS.