Function chrono::format::parse

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

Tries to parse given string into parsed with given formatting items. Returns Ok when the entire string has been parsed (otherwise parsed should not be used). There should be no trailing string after parsing; use a stray Item::Space to trim whitespaces.

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 whitespace then any number of zeroes before numbers.

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