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

zbraniecki / icu4x / 13958601093

19 Mar 2025 04:17PM UTC coverage: 74.164% (-1.5%) from 75.71%
13958601093

push

github

web-flow
Clean up properties docs (#6315)

58056 of 78281 relevant lines covered (74.16%)

819371.32 hits per line

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

32.14
/components/datetime/src/provider/skeleton/error.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
use crate::provider::fields;
6
use displaydoc::Display;
7

8
/// These strings follow the recommendations for the serde::de::Unexpected::Other type.
9
/// <https://docs.serde.rs/serde/de/enum.Unexpected.html#variant.Other>
10
///
11
/// Serde will generate an error such as:
12
/// "invalid value: unclosed literal in pattern, expected a valid UTS 35 pattern string at line 1 column 12"
13
#[derive(Display, Debug, Copy, Clone, PartialEq)]
1✔
14
#[allow(missing_docs)]
15
#[non_exhaustive]
16
pub enum SkeletonError {
17
    #[displaydoc("field too long in skeleton")]
18
    InvalidFieldLength,
19
    #[displaydoc("duplicate field in skeleton")]
20
    DuplicateField,
21
    #[displaydoc("symbol unknown {0} in skeleton")]
×
22
    SymbolUnknown(char),
×
23
    #[displaydoc("symbol invalid {0} in skeleton")]
×
24
    SymbolInvalid(u8),
×
25
    #[displaydoc("symbol unimplemented {0} in skeleton")]
×
26
    SymbolUnimplemented(char),
×
27
    #[displaydoc("unimplemented field {0} in skeleton")]
×
28
    UnimplementedField(char),
×
29
    #[displaydoc("skeleton has a variant subtag")]
30
    SkeletonHasVariant,
31
    #[displaydoc("{0}")]
×
32
    Fields(fields::Error),
×
33
}
34

35
impl core::error::Error for SkeletonError {}
36

37
impl From<fields::Error> for SkeletonError {
38
    fn from(e: fields::Error) -> Self {
×
39
        SkeletonError::Fields(e)
×
40
    }
×
41
}
42

43
impl From<fields::LengthError> for SkeletonError {
44
    fn from(_: fields::LengthError) -> Self {
×
45
        Self::InvalidFieldLength
×
46
    }
×
47
}
48

49
impl From<fields::SymbolError> for SkeletonError {
50
    fn from(symbol_error: fields::SymbolError) -> Self {
44,216✔
51
        match symbol_error {
44,216✔
52
            fields::SymbolError::Invalid(ch) => match ch {
4,620✔
53
                b'-' => Self::SkeletonHasVariant,
4,620✔
54
                _ => Self::SymbolInvalid(ch),
×
55
            },
56
            fields::SymbolError::InvalidIndex(_) => unimplemented!(),
×
57
            fields::SymbolError::Unknown(ch) => {
39,596✔
58
                // NOTE: If you remove a symbol due to it now being supported,
59
                //       make sure to regenerate data: cargo make bakeddata components/datetime.
60
                match ch {
39,596✔
61
                    // TODO(#487) - Flexible day periods
62
                    'B'
63
                    // TODO(#501) - Quarters
64
                    | 'Q' | 'q'
65
                    // Extended year
66
                    | 'u'
67
                    // TODO(#5643) - Weeks
68
                    | 'Y' | 'w' | 'W'
69
                    // Modified Julian Day
70
                    | 'g'
71
                    => Self::SymbolUnimplemented(ch),
39,596✔
72
                    _ => Self::SymbolUnknown(ch),
×
73
                }
74
            }
75
        }
76
    }
44,216✔
77
}
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