• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zbraniecki / icu4x / 11904027177

19 Nov 2024 12:33AM UTC coverage: 75.477% (+0.3%) from 75.174%
11904027177

push

github

web-flow
Move DateTimePattern into pattern module (#5834)

#1317

Also removes `NeoNeverMarker` and fixes #5689

258 of 319 new or added lines in 6 files covered. (80.88%)

6967 existing lines in 278 files now uncovered.

54522 of 72237 relevant lines covered (75.48%)

655305.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.17
/components/datetime/src/input.rs
1
// This file is part of ICU4X. For terms of use, please see the file
2
// called LICENSE at the top level of the ICU4X source tree
3
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4

5
//! A collection of utilities for representing and working with dates as an input to
6
//! formatting operations.
7

8
use crate::scaffold::{DateInputMarkers, GetField, TimeMarkers, ZoneMarkers};
9
use icu_calendar::types::DayOfYearInfo;
10
use icu_calendar::{Date, Iso, Time};
11
use icu_timezone::scaffold::IntoOption;
12
use icu_timezone::{TimeZoneBcp47Id, UtcOffset, ZoneVariant};
13

14
// TODO(#2630) fix up imports to directly import from icu_calendar
15
pub(crate) use icu_calendar::types::{
16
    DayOfMonth, IsoHour, IsoMinute, IsoSecond, IsoWeekday, MonthInfo, NanoSecond, YearInfo,
17
};
18

UNCOV
19
#[derive(Debug, Copy, Clone)]
×
20
pub(crate) struct ExtractedInput {
UNCOV
21
    pub(crate) year: Option<YearInfo>,
×
UNCOV
22
    pub(crate) month: Option<MonthInfo>,
×
UNCOV
23
    pub(crate) day_of_month: Option<DayOfMonth>,
×
UNCOV
24
    pub(crate) iso_weekday: Option<IsoWeekday>,
×
UNCOV
25
    pub(crate) day_of_year: Option<DayOfYearInfo>,
×
UNCOV
26
    pub(crate) hour: Option<IsoHour>,
×
UNCOV
27
    pub(crate) minute: Option<IsoMinute>,
×
UNCOV
28
    pub(crate) second: Option<IsoSecond>,
×
29
    pub(crate) nanosecond: Option<NanoSecond>,
UNCOV
30
    pub(crate) time_zone_id: Option<TimeZoneBcp47Id>,
×
UNCOV
31
    pub(crate) offset: Option<UtcOffset>,
×
UNCOV
32
    pub(crate) zone_variant: Option<ZoneVariant>,
×
UNCOV
33
    pub(crate) local_time: Option<(Date<Iso>, Time)>,
×
34
}
35

36
impl ExtractedInput {
37
    /// Construct given neo date input instances.
38
    pub(crate) fn extract_from_neo_input<D, T, Z, I>(input: &I) -> Self
36✔
39
    where
40
        D: DateInputMarkers,
41
        T: TimeMarkers,
42
        Z: ZoneMarkers,
43
        I: ?Sized
44
            + GetField<D::YearInput>
45
            + GetField<D::MonthInput>
46
            + GetField<D::DayOfMonthInput>
47
            + GetField<D::DayOfWeekInput>
48
            + GetField<D::DayOfYearInput>
49
            + GetField<T::HourInput>
50
            + GetField<T::MinuteInput>
51
            + GetField<T::SecondInput>
52
            + GetField<T::NanoSecondInput>
53
            + GetField<Z::TimeZoneIdInput>
54
            + GetField<Z::TimeZoneOffsetInput>
55
            + GetField<Z::TimeZoneVariantInput>
56
            + GetField<Z::TimeZoneLocalTimeInput>,
57
    {
58
        Self {
36✔
59
            year: GetField::<D::YearInput>::get_field(input).into_option(),
36✔
60
            month: GetField::<D::MonthInput>::get_field(input).into_option(),
36✔
61
            day_of_month: GetField::<D::DayOfMonthInput>::get_field(input).into_option(),
36✔
62
            iso_weekday: GetField::<D::DayOfWeekInput>::get_field(input).into_option(),
36✔
63
            day_of_year: GetField::<D::DayOfYearInput>::get_field(input).into_option(),
36✔
64
            hour: GetField::<T::HourInput>::get_field(input).into_option(),
36✔
65
            minute: GetField::<T::MinuteInput>::get_field(input).into_option(),
36✔
66
            second: GetField::<T::SecondInput>::get_field(input).into_option(),
36✔
67
            nanosecond: GetField::<T::NanoSecondInput>::get_field(input).into_option(),
36✔
68
            time_zone_id: GetField::<Z::TimeZoneIdInput>::get_field(input).into_option(),
36✔
69
            offset: GetField::<Z::TimeZoneOffsetInput>::get_field(input).into_option(),
36✔
70
            zone_variant: GetField::<Z::TimeZoneVariantInput>::get_field(input).into_option(),
36✔
71
            local_time: GetField::<Z::TimeZoneLocalTimeInput>::get_field(input).into_option(),
36✔
72
        }
73
    }
36✔
74
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc