Debian Codegraph @

debian/rust-vendor/icu_decimal/src/error.rs

raw
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 //! Error types for functions in the decimal crate
6
7 use displaydoc::Display;
8
9 /// An error due to incorrect arguments to
10 /// [`CompactDecimalFormatter::format_with_exponent`](crate::CompactDecimalFormatter::format_with_exponent).
11 ///
12 /// <div class="stab unstable">
13 /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
14 /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break.
15 ///
16 /// Graduation tracking issue: [issue #7161](https://github.com/unicode-org/icu4x/issues/7161).
17 /// </div>
18 ///
19 /// ✨ *Enabled with the `unstable` Cargo feature.*
20 #[derive(Display, Copy, Clone, Debug)]
21 #[displaydoc("Expected compact exponent {expected} for 10^{magnitude}, got {actual}")]
22 pub struct CompactExponentError {
23 /// The compact decimal exponent passed to the formatter.
24 pub(crate) actual: u8,
25 /// The appropriate exponent for a number of the given magnitude.
26 pub(crate) expected: u8,
27 /// The magnitude of the number being formatted.
28 pub(crate) magnitude: i16,
29 }
30
31 impl core::error::Error for CompactExponentError {}