chinese_format/lib.rs
1//! This crate focuses on converting data types to [Chinese],
2//! which can be achieved by implementing the [ChineseFormat] trait.
3//!
4//! As a consequence, the library provides:
5//!
6//! - **ready-made conversions** for standard data types (integers,
7//! strings, [Option], pairs, ...) - but also for fairly specific types like [DigitSequence](digit_sequence::DigitSequence).
8//!
9//! - **Gregorian date/time**, in the [gregorian] module, in different formats via [DateBuilder](gregorian::DateBuilder), [LinearTime](gregorian::LinearTime) and [DeltaTime](gregorian::DeltaTime).
10//!
11//! - **Monetary units**, in the [currency] module - at present, [RenminbiCurrency](currency::RenminbiCurrency) (人民币).
12//!
13//! - **Dedicated numeric types** - such as [Decimal], [Fraction] and [Sign].
14//!
15//! - the [ChineseVec] sequence, to simplify the manipulation of _arbitrary
16//! chains of logograms_, as well as **placeholders**.
17//!
18//! - the [Measure] trait and its related macros - especially [define_measure].
19//!
20//! # Features
21//!
22//! The crate supports the following _optional_ features:
23//!
24//! - `digit-sequence`:
25//!
26//! - enables conversions to Chinese for [DigitSequence](https://crates.io/crates/digit-sequence).
27//!
28//! - enables the [Decimal] and [IntegerPart] types.
29//!
30//! - `currency`: enables the whole [currency] module for monetary conversions.
31//!
32//! - `gregorian`: enables the [gregorian] module for date/time conversions.
33//!
34//! _Also enables_: `digit-sequence`.
35mod chinese;
36mod count;
37#[cfg(feature = "digit-sequence")]
38mod decimal;
39#[cfg(feature = "digit-sequence")]
40mod digit_sequences;
41mod financial;
42mod fraction;
43mod integers;
44mod left_padder;
45mod measure;
46mod option;
47mod placeholders;
48mod sign;
49mod strings;
50mod tuple;
51mod vector;
52
53#[cfg(feature = "currency")]
54pub mod currency;
55#[cfg(feature = "gregorian")]
56pub mod gregorian;
57pub mod length;
58pub mod weight;
59
60pub use chinese::*;
61pub use count::*;
62#[cfg(feature = "digit-sequence")]
63pub use decimal::*;
64pub use financial::*;
65pub use fraction::*;
66pub use left_padder::*;
67pub use measure::*;
68pub use placeholders::*;
69pub use sign::*;
70pub use vector::*;
71
72use std::error::Error;
73
74/// The most generic [Error]-based [Result].
75pub type GenericResult<T> = Result<T, Box<dyn Error>>;