pub(crate) fn try_from_parsed_items(items: ParsedItems) -> ParseResult<Self> {
        macro_rules! items {
            ($($item:ident),* $(,)?) => {
                ParsedItems { $($item: Some($item)),*, .. }
            };
        }

        /// Convert a 12-hour time to a 24-hour time.
        #[allow(clippy::missing_const_for_fn)] // internal fn in non-const outer fn
        fn hour_12_to_24(hour: NonZeroU8, am_pm: AmPm) -> u8 {
            use AmPm::{AM, PM};
            match (hour.get(), am_pm) {
                (12, AM) => 0,
                (12, PM) => 12,
                (h, AM) => h,
                (h, PM) => h + 12,
            }
        }

        match items {
            items!(hour_24, minute, second, nanosecond) => {
                Self::try_from_hms_nano(hour_24, minute, second, nanosecond).map_err(Into::into)
            }
            items!(hour_12, minute, second, nanosecond, am_pm) => {
                Self::try_from_hms_nano(hour_12_to_24(hour_12, am_pm), minute, second, nanosecond)
                    .map_err(Into::into)
            }
            items!(hour_24, minute, second) => {
                Self::try_from_hms(hour_24, minute, second).map_err(Into::into)
            }
            items!(hour_12, minute, second, am_pm) => {
                Self::try_from_hms(hour_12_to_24(hour_12, am_pm), minute, second)
                    .map_err(Into::into)
            }
            items!(hour_24, minute) => Self::try_from_hms(hour_24, minute, 0).map_err(Into::into),
            items!(hour_12, minute, am_pm) => {
                Self::try_from_hms(hour_12_to_24(hour_12, am_pm), minute, 0).map_err(Into::into)
            }
            items!(hour_24) => Self::try_from_hms(hour_24, 0, 0).map_err(Into::into),
            items!(hour_12, am_pm) => {
                Self::try_from_hms(hour_12_to_24(hour_12, am_pm), 0, 0).map_err(Into::into)
            }
            _ => Err(error::Parse::InsufficientInformation),
        }
    }
/// Given the items already parsed, attempt to create a `Time`.
Given the items already parsed, attempt to create a `Time`.
Given the items already parsed attempt to create a ` Time ` .
pub(crate) fn try_from_parsed_items(items: ParsedItems) -> ParseResult<Self> {
        macro_rules! items {
            ($($item:ident),* $(,)?) => {
                ParsedItems { $($item: Some($item)),*, .. }
            };
        }
        /// Convert a 12-hour time to a 24-hour time.
        #[allow(clippy::missing_const_for_fn)] // internal fn in non-const outer fn
        fn hour_12_to_24(hour: NonZeroU8, am_pm: AmPm) -> u8 {
            use AmPm::{AM, PM};
            match (hour.get(), am_pm) {
                (12, AM) => 0,
                (12, PM) => 12,
                (h, AM) => h,
                (h, PM) => h + 12,
            }
        }
        match items {
            items!(hour_24, minute, second, nanosecond) => {
                Self::try_from_hms_nano(hour_24, minute, second, nanosecond).map_err(Into::into)
            }
            items!(hour_12, minute, second, nanosecond, am_pm) => {
                Self::try_from_hms_nano(hour_12_to_24(hour_12, am_pm), minute, second, nanosecond)
                    .map_err(Into::into)
            }
            items!(hour_24, minute, second) => {
                Self::try_from_hms(hour_24, minute, second).map_err(Into::into)
            }
            items!(hour_12, minute, second, am_pm) => {
                Self::try_from_hms(hour_12_to_24(hour_12, am_pm), minute, second)
                    .map_err(Into::into)
            }
            items!(hour_24, minute) => Self::try_from_hms(hour_24, minute, 0).map_err(Into::into),
            items!(hour_12, minute, am_pm) => {
                Self::try_from_hms(hour_12_to_24(hour_12, am_pm), minute, 0).map_err(Into::into)
            }
            items!(hour_24) => Self::try_from_hms(hour_24, 0, 0).map_err(Into::into),
            items!(hour_12, am_pm) => {
                Self::try_from_hms(hour_12_to_24(hour_12, am_pm), 0, 0).map_err(Into::into)
            }
            _ => Err(error::Parse::InsufficientInformation),
        }
    }
pub ( crate ) fn try_from_parsed_items ( items : ParsedItems ) -> ParseResult < Self > { macro_rules! items { ( $ ( $item : ident ) * $ ( ) ? ) => { ParsedItems { $ ( $item Some ( $item ) ) * } } ; } /// Convert a 12-hour time to a 24-hour time. # [ allow ( clippy missing_const_for_fn ) ] // internal fn in non-const outer fn fn hour_12_to_24 ( hour : NonZeroU8 , am_pm : AmPm ) -> u8 { use AmPm :: { AM , PM } ; match ( hour . get ( ) , am_pm ) { ( 12 , AM ) => 0 , ( 12 , PM ) => 12 , ( h , AM ) => h , ( h , PM ) => h + 12 , } } match items { items ! ( hour_24 minute second nanosecond ) => { Self :: try_from_hms_nano ( hour_24 , minute , second , nanosecond ) . map_err ( Into :: into ) } items ! ( hour_12 minute second nanosecond am_pm ) => { Self :: try_from_hms_nano ( hour_12_to_24 ( hour_12 , am_pm ) , minute , second , nanosecond ) . map_err ( Into :: into ) } items ! ( hour_24 minute second ) => { Self :: try_from_hms ( hour_24 , minute , second ) . map_err ( Into :: into ) } items ! ( hour_12 minute second am_pm ) => { Self :: try_from_hms ( hour_12_to_24 ( hour_12 , am_pm ) , minute , second ) . map_err ( Into :: into ) } items ! ( hour_24 minute ) => Self :: try_from_hms ( hour_24 , minute , 0 ) . map_err ( Into :: into ) , items ! ( hour_12 minute am_pm ) => { Self :: try_from_hms ( hour_12_to_24 ( hour_12 , am_pm ) , minute , 0 ) . map_err ( Into :: into ) } items ! ( hour_24 ) => Self :: try_from_hms ( hour_24 , 0 , 0 ) . map_err ( Into :: into ) , items ! ( hour_12 am_pm ) => { Self :: try_from_hms ( hour_12_to_24 ( hour_12 , am_pm ) , 0 , 0 ) . map_err ( Into :: into ) } _ => Err ( error :: Parse :: InsufficientInformation ) , } }
Given the items already parsed, attempt to create a `Time`.
Given the items already parsed attempt to create a ` Time ` .
items
ParsedItems
items
ParsedItems