lexical_util/
not_feature_format.rs

1//! Bare bones implementation of the format packed struct without feature
2//! `format`.
3//!
4//! See `feature_format` for detailed documentation.
5
6#![cfg(not(feature = "format"))]
7
8use crate::error::Error;
9use crate::format_builder::NumberFormatBuilder;
10use crate::format_flags as flags;
11
12/// Wrapper for the 128-bit packed struct.
13///
14/// The following values are explicitly set, and therefore not configurable:
15///     1. required_integer_digits
16///     2. required_fraction_digits
17///     3. required_exponent_digits
18///     4. required_mantissa_digits
19///     5. required_digits
20///     6. no_positive_mantissa_sign
21///     7. required_mantissa_sign
22///     8. no_exponent_notation
23///     9. no_positive_exponent_sign
24///     10. required_exponent_sign
25///     11. no_exponent_without_fraction
26///     12. no_special
27///     13. case_sensitive_special
28///     14. no_integer_leading_zeros
29///     15. no_float_leading_zeros
30///     16. required_exponent_notation
31///     17. case_sensitive_exponent
32///     18. case_sensitive_base_prefix
33///     19. case_sensitive_base_suffix
34///     20. integer_internal_digit_separator
35///     21. fraction_internal_digit_separator
36///     22. exponent_internal_digit_separator
37///     23. internal_digit_separator
38///     24. integer_leading_digit_separator
39///     25. fraction_leading_digit_separator
40///     26. exponent_leading_digit_separator
41///     27. leading_digit_separator
42///     28. integer_trailing_digit_separator
43///     29. fraction_trailing_digit_separator
44///     30. exponent_trailing_digit_separator
45///     31. trailing_digit_separator
46///     32. integer_consecutive_digit_separator
47///     33. fraction_consecutive_digit_separator
48///     34. exponent_consecutive_digit_separator
49///     35. consecutive_digit_separator
50///     36. special_digit_separator
51///     37. digit_separator
52///     38. base_prefix
53///     39. base_suffix
54///     40. exponent_base
55///     41. exponent_radix
56///
57/// See `NumberFormatBuilder` for the `FORMAT` fields
58/// for the packed struct.
59#[doc(hidden)]
60pub struct NumberFormat<const FORMAT: u128>;
61
62impl<const FORMAT: u128> NumberFormat<FORMAT> {
63    // CONSTRUCTORS
64
65    /// Create new instance (for methods and validation).
66    pub const fn new() -> Self {
67        Self {}
68    }
69
70    // VALIDATION
71
72    /// Determine if the number format is valid.
73    pub const fn is_valid(&self) -> bool {
74        self.error().is_success()
75    }
76
77    /// Get the error type from the format.
78    pub const fn error(&self) -> Error {
79        let valid_flags = flags::REQUIRED_EXPONENT_DIGITS | flags::REQUIRED_MANTISSA_DIGITS;
80        if !flags::is_valid_radix(self.mantissa_radix()) {
81            Error::InvalidMantissaRadix
82        } else if !flags::is_valid_radix(self.exponent_base()) {
83            Error::InvalidExponentBase
84        } else if !flags::is_valid_radix(self.exponent_radix()) {
85            Error::InvalidExponentRadix
86        } else if !flags::is_valid_digit_separator(FORMAT) {
87            Error::InvalidDigitSeparator
88        } else if !flags::is_valid_base_prefix(FORMAT) {
89            Error::InvalidBasePrefix
90        } else if !flags::is_valid_base_suffix(FORMAT) {
91            Error::InvalidBaseSuffix
92        } else if !flags::is_valid_punctuation(FORMAT) {
93            Error::InvalidPunctuation
94        } else if self.flags() != valid_flags {
95            Error::InvalidFlags
96        } else {
97            Error::Success
98        }
99    }
100
101    // NON-DIGIT SEPARATOR FLAGS & MASKS
102
103    /// If digits are required before the decimal point.
104    pub const REQUIRED_INTEGER_DIGITS: bool = false;
105
106    /// Get if digits are required before the decimal point.
107    #[inline(always)]
108    pub const fn required_integer_digits(&self) -> bool {
109        Self::REQUIRED_INTEGER_DIGITS
110    }
111
112    /// If digits are required after the decimal point.
113    pub const REQUIRED_FRACTION_DIGITS: bool = false;
114
115    /// Get if digits are required after the decimal point.
116    #[inline(always)]
117    pub const fn required_fraction_digits(&self) -> bool {
118        Self::REQUIRED_FRACTION_DIGITS
119    }
120
121    /// If digits are required after the exponent character.
122    pub const REQUIRED_EXPONENT_DIGITS: bool = true;
123
124    /// Get if digits are required after the exponent character.
125    #[inline(always)]
126    pub const fn required_exponent_digits(&self) -> bool {
127        Self::REQUIRED_EXPONENT_DIGITS
128    }
129
130    /// If significant digits are required.
131    pub const REQUIRED_MANTISSA_DIGITS: bool = true;
132
133    /// Get if significant digits are required.
134    #[inline(always)]
135    pub const fn required_mantissa_digits(&self) -> bool {
136        Self::REQUIRED_MANTISSA_DIGITS
137    }
138
139    /// If at least 1 digit in the number is required.
140    pub const REQUIRED_DIGITS: bool = true;
141
142    /// Get if at least 1 digit in the number is required.
143    #[inline(always)]
144    pub const fn required_digits(&self) -> bool {
145        Self::REQUIRED_DIGITS
146    }
147
148    /// If a positive sign before the mantissa is not allowed.
149    pub const NO_POSITIVE_MANTISSA_SIGN: bool = false;
150
151    /// Get if a positive sign before the mantissa is not allowed.
152    #[inline(always)]
153    pub const fn no_positive_mantissa_sign(&self) -> bool {
154        Self::NO_POSITIVE_MANTISSA_SIGN
155    }
156
157    /// If a sign symbol before the mantissa is required.
158    pub const REQUIRED_MANTISSA_SIGN: bool = false;
159
160    /// Get if a sign symbol before the mantissa is required.
161    #[inline(always)]
162    pub const fn required_mantissa_sign(&self) -> bool {
163        Self::REQUIRED_MANTISSA_SIGN
164    }
165
166    /// If exponent notation is not allowed.
167    pub const NO_EXPONENT_NOTATION: bool = false;
168
169    /// Get if exponent notation is not allowed.
170    #[inline(always)]
171    pub const fn no_exponent_notation(&self) -> bool {
172        Self::NO_EXPONENT_NOTATION
173    }
174
175    /// If a positive sign before the exponent is not allowed.
176    pub const NO_POSITIVE_EXPONENT_SIGN: bool = false;
177
178    /// Get if a positive sign before the exponent is not allowed.
179    #[inline(always)]
180    pub const fn no_positive_exponent_sign(&self) -> bool {
181        Self::NO_POSITIVE_EXPONENT_SIGN
182    }
183
184    /// If a sign symbol before the exponent is required.
185    pub const REQUIRED_EXPONENT_SIGN: bool = false;
186
187    /// Get if a sign symbol before the exponent is required.
188    #[inline(always)]
189    pub const fn required_exponent_sign(&self) -> bool {
190        Self::REQUIRED_EXPONENT_SIGN
191    }
192
193    /// If an exponent without fraction is not allowed.
194    pub const NO_EXPONENT_WITHOUT_FRACTION: bool = false;
195
196    /// Get if an exponent without fraction is not allowed.
197    #[inline(always)]
198    pub const fn no_exponent_without_fraction(&self) -> bool {
199        Self::NO_EXPONENT_WITHOUT_FRACTION
200    }
201
202    /// If special (non-finite) values are not allowed.
203    pub const NO_SPECIAL: bool = false;
204
205    /// Get if special (non-finite) values are not allowed.
206    #[inline(always)]
207    pub const fn no_special(&self) -> bool {
208        Self::NO_SPECIAL
209    }
210
211    /// If special (non-finite) values are case-sensitive.
212    pub const CASE_SENSITIVE_SPECIAL: bool = false;
213
214    /// Get if special (non-finite) values are case-sensitive.
215    #[inline(always)]
216    pub const fn case_sensitive_special(&self) -> bool {
217        Self::CASE_SENSITIVE_SPECIAL
218    }
219
220    /// If leading zeros before an integer are not allowed.
221    pub const NO_INTEGER_LEADING_ZEROS: bool = false;
222
223    /// Get if leading zeros before an integer are not allowed.
224    #[inline(always)]
225    pub const fn no_integer_leading_zeros(&self) -> bool {
226        Self::NO_INTEGER_LEADING_ZEROS
227    }
228
229    /// If leading zeros before a float are not allowed.
230    pub const NO_FLOAT_LEADING_ZEROS: bool = false;
231
232    /// Get if leading zeros before a float are not allowed.
233    #[inline(always)]
234    pub const fn no_float_leading_zeros(&self) -> bool {
235        Self::NO_FLOAT_LEADING_ZEROS
236    }
237
238    /// If exponent notation is required.
239    pub const REQUIRED_EXPONENT_NOTATION: bool = false;
240
241    /// Get if exponent notation is required.
242    #[inline(always)]
243    pub const fn required_exponent_notation(&self) -> bool {
244        Self::REQUIRED_EXPONENT_NOTATION
245    }
246
247    /// If exponent characters are case-sensitive.
248    pub const CASE_SENSITIVE_EXPONENT: bool = false;
249
250    /// Get if exponent characters are case-sensitive.
251    #[inline(always)]
252    pub const fn case_sensitive_exponent(&self) -> bool {
253        Self::CASE_SENSITIVE_EXPONENT
254    }
255
256    /// If base prefixes are case-sensitive.
257    pub const CASE_SENSITIVE_BASE_PREFIX: bool = false;
258
259    /// Get if base prefixes are case-sensitive.
260    #[inline(always)]
261    pub const fn case_sensitive_base_prefix(&self) -> bool {
262        Self::CASE_SENSITIVE_BASE_PREFIX
263    }
264
265    /// If base suffixes are case-sensitive.
266    pub const CASE_SENSITIVE_BASE_SUFFIX: bool = false;
267
268    /// Get if base suffixes are case-sensitive.
269    #[inline(always)]
270    pub const fn case_sensitive_base_suffix(&self) -> bool {
271        Self::CASE_SENSITIVE_BASE_SUFFIX
272    }
273
274    // DIGIT SEPARATOR FLAGS & MASKS
275
276    // If digit separators are allowed between integer digits.
277    ///
278    /// This will not consider an input of only the digit separator
279    /// to be a valid separator: the digit separator must be surrounded by
280    /// digits.
281    pub const INTEGER_INTERNAL_DIGIT_SEPARATOR: bool = false;
282
283    /// Get if digit separators are allowed between integer digits.
284    ///
285    /// This will not consider an input of only the digit separator
286    /// to be a valid separator: the digit separator must be surrounded by
287    /// digits.
288    #[inline(always)]
289    pub const fn integer_internal_digit_separator(&self) -> bool {
290        Self::INTEGER_INTERNAL_DIGIT_SEPARATOR
291    }
292
293    /// If digit separators are allowed between fraction digits.
294    ///
295    /// This will not consider an input of only the digit separator
296    /// to be a valid separator: the digit separator must be surrounded by
297    /// digits.
298    pub const FRACTION_INTERNAL_DIGIT_SEPARATOR: bool = false;
299
300    /// Get if digit separators are allowed between fraction digits.
301    ///
302    /// This will not consider an input of only the digit separator
303    /// to be a valid separator: the digit separator must be surrounded by
304    /// digits.
305    #[inline(always)]
306    pub const fn fraction_internal_digit_separator(&self) -> bool {
307        Self::FRACTION_INTERNAL_DIGIT_SEPARATOR
308    }
309
310    /// If digit separators are allowed between exponent digits.
311    ///
312    /// This will not consider an input of only the digit separator
313    /// to be a valid separator: the digit separator must be surrounded by
314    /// digits.
315    pub const EXPONENT_INTERNAL_DIGIT_SEPARATOR: bool = false;
316
317    /// Get if digit separators are allowed between exponent digits.
318    ///
319    /// This will not consider an input of only the digit separator
320    /// to be a valid separator: the digit separator must be surrounded by
321    /// digits.
322    #[inline(always)]
323    pub const fn exponent_internal_digit_separator(&self) -> bool {
324        Self::EXPONENT_INTERNAL_DIGIT_SEPARATOR
325    }
326
327    /// If digit separators are allowed between digits.
328    ///
329    /// This will not consider an input of only the digit separator
330    /// to be a valid separator: the digit separator must be surrounded by
331    /// digits.
332    pub const INTERNAL_DIGIT_SEPARATOR: bool = false;
333
334    /// Get if digit separators are allowed between digits.
335    ///
336    /// This will not consider an input of only the digit separator
337    /// to be a valid separator: the digit separator must be surrounded by
338    /// digits.
339    #[inline(always)]
340    pub const fn internal_digit_separator(&self) -> bool {
341        Self::INTERNAL_DIGIT_SEPARATOR
342    }
343
344    /// If a digit separator is allowed before any integer digits.
345    ///
346    /// This will consider an input of only the digit separator
347    /// to be a identical to empty input.
348    pub const INTEGER_LEADING_DIGIT_SEPARATOR: bool = false;
349
350    /// Get if a digit separator is allowed before any integer digits.
351    ///
352    /// This will consider an input of only the digit separator
353    /// to be a identical to empty input.
354    #[inline(always)]
355    pub const fn integer_leading_digit_separator(&self) -> bool {
356        Self::INTEGER_LEADING_DIGIT_SEPARATOR
357    }
358
359    /// If a digit separator is allowed before any integer digits.
360    ///
361    /// This will consider an input of only the digit separator
362    /// to be a identical to empty input.
363    pub const FRACTION_LEADING_DIGIT_SEPARATOR: bool = false;
364
365    /// Get if a digit separator is allowed before any fraction digits.
366    ///
367    /// This will consider an input of only the digit separator
368    /// to be a identical to empty input.
369    #[inline(always)]
370    pub const fn fraction_leading_digit_separator(&self) -> bool {
371        Self::FRACTION_LEADING_DIGIT_SEPARATOR
372    }
373
374    /// If a digit separator is allowed before any exponent digits.
375    ///
376    /// This will consider an input of only the digit separator
377    /// to be a identical to empty input.
378    pub const EXPONENT_LEADING_DIGIT_SEPARATOR: bool = false;
379
380    /// Get if a digit separator is allowed before any exponent digits.
381    ///
382    /// This will consider an input of only the digit separator
383    /// to be a identical to empty input.
384    #[inline(always)]
385    pub const fn exponent_leading_digit_separator(&self) -> bool {
386        Self::EXPONENT_LEADING_DIGIT_SEPARATOR
387    }
388
389    /// If a digit separator is allowed before any digits.
390    ///
391    /// This will consider an input of only the digit separator
392    /// to be a identical to empty input.
393    pub const LEADING_DIGIT_SEPARATOR: bool = false;
394
395    /// Get if a digit separator is allowed before any digits.
396    ///
397    /// This will consider an input of only the digit separator
398    /// to be a identical to empty input.
399    #[inline(always)]
400    pub const fn leading_digit_separator(&self) -> bool {
401        Self::LEADING_DIGIT_SEPARATOR
402    }
403
404    /// If a digit separator is allowed after any integer digits.
405    ///
406    /// This will consider an input of only the digit separator
407    /// to be a identical to empty input.
408    pub const INTEGER_TRAILING_DIGIT_SEPARATOR: bool = false;
409
410    /// Get if a digit separator is allowed after any integer digits.
411    ///
412    /// This will consider an input of only the digit separator
413    /// to be a identical to empty input.
414    #[inline(always)]
415    pub const fn integer_trailing_digit_separator(&self) -> bool {
416        Self::INTEGER_TRAILING_DIGIT_SEPARATOR
417    }
418
419    /// If a digit separator is allowed after any fraction digits.
420    ///
421    /// This will consider an input of only the digit separator
422    /// to be a identical to empty input.
423    pub const FRACTION_TRAILING_DIGIT_SEPARATOR: bool = false;
424
425    /// Get if a digit separator is allowed after any fraction digits.
426    ///
427    /// This will consider an input of only the digit separator
428    /// to be a identical to empty input.
429    #[inline(always)]
430    pub const fn fraction_trailing_digit_separator(&self) -> bool {
431        Self::FRACTION_TRAILING_DIGIT_SEPARATOR
432    }
433
434    /// If a digit separator is allowed after any exponent digits.
435    ///
436    /// This will consider an input of only the digit separator
437    /// to be a identical to empty input.
438    pub const EXPONENT_TRAILING_DIGIT_SEPARATOR: bool = false;
439
440    /// Get if a digit separator is allowed after any exponent digits.
441    ///
442    /// This will consider an input of only the digit separator
443    /// to be a identical to empty input.
444    #[inline(always)]
445    pub const fn exponent_trailing_digit_separator(&self) -> bool {
446        Self::EXPONENT_TRAILING_DIGIT_SEPARATOR
447    }
448
449    /// If a digit separator is allowed after any digits.
450    ///
451    /// This will consider an input of only the digit separator
452    /// to be a identical to empty input.
453    pub const TRAILING_DIGIT_SEPARATOR: bool = false;
454
455    /// Get if a digit separator is allowed after any digits.
456    ///
457    /// This will consider an input of only the digit separator
458    /// to be a identical to empty input.
459    #[inline(always)]
460    pub const fn trailing_digit_separator(&self) -> bool {
461        Self::TRAILING_DIGIT_SEPARATOR
462    }
463
464    /// If multiple consecutive integer digit separators are allowed.
465    pub const INTEGER_CONSECUTIVE_DIGIT_SEPARATOR: bool = false;
466
467    /// Get if multiple consecutive integer digit separators are allowed.
468    #[inline(always)]
469    pub const fn integer_consecutive_digit_separator(&self) -> bool {
470        Self::INTEGER_CONSECUTIVE_DIGIT_SEPARATOR
471    }
472
473    /// If multiple consecutive fraction digit separators are allowed.
474    pub const FRACTION_CONSECUTIVE_DIGIT_SEPARATOR: bool = false;
475
476    /// Get if multiple consecutive fraction digit separators are allowed.
477    #[inline(always)]
478    pub const fn fraction_consecutive_digit_separator(&self) -> bool {
479        Self::FRACTION_CONSECUTIVE_DIGIT_SEPARATOR
480    }
481
482    /// If multiple consecutive exponent digit separators are allowed.
483    pub const EXPONENT_CONSECUTIVE_DIGIT_SEPARATOR: bool = false;
484
485    /// Get if multiple consecutive exponent digit separators are allowed.
486    #[inline(always)]
487    pub const fn exponent_consecutive_digit_separator(&self) -> bool {
488        Self::EXPONENT_CONSECUTIVE_DIGIT_SEPARATOR
489    }
490
491    /// If multiple consecutive digit separators are allowed.
492    pub const CONSECUTIVE_DIGIT_SEPARATOR: bool = false;
493
494    /// Get if multiple consecutive digit separators are allowed.
495    #[inline(always)]
496    pub const fn consecutive_digit_separator(&self) -> bool {
497        Self::CONSECUTIVE_DIGIT_SEPARATOR
498    }
499
500    /// If any digit separators are allowed in special (non-finite) values.
501    pub const SPECIAL_DIGIT_SEPARATOR: bool = false;
502
503    /// Get if any digit separators are allowed in special (non-finite) values.
504    #[inline(always)]
505    pub const fn special_digit_separator(&self) -> bool {
506        Self::SPECIAL_DIGIT_SEPARATOR
507    }
508
509    // CHARACTERS
510
511    /// The digit separator character in the packed struct.
512    pub const DIGIT_SEPARATOR: u8 = 0;
513
514    /// Get the digit separator character.
515    ///
516    /// If the digit separator is 0, digit separators are not allowed.
517    #[inline(always)]
518    pub const fn digit_separator(&self) -> u8 {
519        Self::DIGIT_SEPARATOR
520    }
521
522    /// The base prefix character in the packed struct.
523    pub const BASE_PREFIX: u8 = 0;
524
525    /// Get the character for the base prefix.
526    ///
527    /// If the base prefix is 0, base prefixes are not allowed.
528    /// The number will have then have the format `0$base_prefix...`.
529    /// For example, a hex base prefix would be `0x`. Base prefixes are
530    /// always optional.
531    #[inline(always)]
532    pub const fn base_prefix(&self) -> u8 {
533        Self::BASE_PREFIX
534    }
535
536    /// Get if the format has a base prefix.
537    #[inline(always)]
538    pub const fn has_base_prefix(&self) -> bool {
539        false
540    }
541
542    /// The base suffix character in the packed struct.
543    pub const BASE_SUFFIX: u8 = 0;
544
545    /// Character for the base suffix.
546    ///
547    /// If not provided, base suffixes are not allowed.
548    /// The number will have then have the format `...$base_suffix`.
549    /// For example, a hex base prefix would be `0x`. Base prefixes are
550    /// always optional.
551    #[inline(always)]
552    pub const fn base_suffix(&self) -> u8 {
553        Self::BASE_SUFFIX
554    }
555
556    /// Get if the format has a base suffix.
557    #[inline(always)]
558    pub const fn has_base_suffix(&self) -> bool {
559        false
560    }
561
562    // RADIX
563
564    /// The radix for the significant digits in the packed struct.
565    pub const MANTISSA_RADIX: u32 = flags::mantissa_radix(FORMAT);
566
567    /// Get the radix for the mantissa digits.
568    #[inline(always)]
569    pub const fn mantissa_radix(&self) -> u32 {
570        Self::MANTISSA_RADIX
571    }
572
573    /// The radix for the significant digits in the packed struct.
574    /// Alias for `MANTISSA_RADIX`.
575    pub const RADIX: u32 = Self::MANTISSA_RADIX;
576
577    /// Get the radix for the significant digits.
578    #[inline(always)]
579    pub const fn radix(&self) -> u32 {
580        Self::RADIX
581    }
582
583    /// Get the radix**2 for the significant digits.
584    #[inline(always)]
585    pub const fn radix2(&self) -> u32 {
586        self.radix().wrapping_mul(self.radix())
587    }
588
589    /// Get the radix**4 for the significant digits.
590    #[inline(always)]
591    pub const fn radix4(&self) -> u32 {
592        self.radix2().wrapping_mul(self.radix2())
593    }
594
595    /// Get the radix*** for the significant digits.
596    #[inline(always)]
597    pub const fn radix8(&self) -> u32 {
598        self.radix4().wrapping_mul(self.radix4())
599    }
600
601    /// The base for the exponent.
602    pub const EXPONENT_BASE: u32 = flags::exponent_base(FORMAT);
603
604    /// Get the base for the exponent.
605    ///
606    /// IE, a base of 2 means we have `mantissa * 2^exponent`.
607    /// If not provided, it defaults to `radix`.
608    #[inline(always)]
609    pub const fn exponent_base(&self) -> u32 {
610        Self::EXPONENT_BASE
611    }
612
613    /// The radix for the exponent digits.
614    pub const EXPONENT_RADIX: u32 = flags::exponent_radix(FORMAT);
615
616    /// Get the radix for the exponent digits.
617    #[inline(always)]
618    pub const fn exponent_radix(&self) -> u32 {
619        Self::EXPONENT_RADIX
620    }
621
622    // FLAGS
623
624    /// Get the flags from the number format.
625    #[inline(always)]
626    pub const fn flags(&self) -> u128 {
627        FORMAT & flags::FLAG_MASK
628    }
629
630    /// Get the interface flags from the number format.
631    #[inline(always)]
632    pub const fn interface_flags(&self) -> u128 {
633        FORMAT & flags::INTERFACE_FLAG_MASK
634    }
635
636    /// Get the digit separator flags from the number format.
637    #[inline(always)]
638    pub const fn digit_separator_flags(&self) -> u128 {
639        FORMAT & flags::DIGIT_SEPARATOR_FLAG_MASK
640    }
641
642    /// Get the exponent flags from the number format.
643    #[inline(always)]
644    pub const fn exponent_flags(&self) -> u128 {
645        FORMAT & flags::EXPONENT_FLAG_MASK
646    }
647
648    /// Get the integer digit separator flags from the number format.
649    #[inline(always)]
650    pub const fn integer_digit_separator_flags(&self) -> u128 {
651        FORMAT & flags::INTEGER_DIGIT_SEPARATOR_FLAG_MASK
652    }
653
654    /// Get the fraction digit separator flags from the number format.
655    #[inline(always)]
656    pub const fn fraction_digit_separator_flags(&self) -> u128 {
657        FORMAT & flags::FRACTION_DIGIT_SEPARATOR_FLAG_MASK
658    }
659
660    /// Get the exponent digit separator flags from the number format.
661    #[inline(always)]
662    pub const fn exponent_digit_separator_flags(&self) -> u128 {
663        FORMAT & flags::EXPONENT_DIGIT_SEPARATOR_FLAG_MASK
664    }
665
666    // BUILDER
667
668    /// Get the number format builder from the format.
669    #[inline]
670    pub const fn builder() -> NumberFormatBuilder {
671        NumberFormatBuilder::new()
672    }
673
674    /// Get the number format builder from the format.
675    #[inline]
676    pub const fn rebuild() -> NumberFormatBuilder {
677        NumberFormatBuilder::rebuild(FORMAT)
678    }
679}
680
681impl<const FORMAT: u128> Default for NumberFormat<FORMAT> {
682    fn default() -> Self {
683        Self::new()
684    }
685}