Expand description
This crate focuses on converting data types to Chinese, which can be achieved by implementing the ChineseFormat trait.
As a consequence, the library provides:
-
ready-made conversions for standard data types (integers, strings, Option, pairs, …) - but also for fairly specific types like DigitSequence.
-
Gregorian date/time, in the gregorian module, in different formats via DateBuilder, LinearTime and DeltaTime.
-
Monetary units, in the currency module - at present, RenminbiCurrency (人民币).
-
Dedicated numeric types - such as Decimal, Fraction and Sign.
-
the ChineseVec sequence, to simplify the manipulation of arbitrary chains of logograms, as well as placeholders.
-
the Measure trait and its related macros - especially define_measure.
§Features
The crate supports the following optional features:
-
digit-sequence
:-
enables conversions to Chinese for DigitSequence.
-
enables the Decimal and IntegerPart types.
-
-
currency
: enables the whole currency module for monetary conversions. -
gregorian
: enables the gregorian module for date/time conversions.Also enables:
digit-sequence
.
Modules§
- currency
- Currencies from all over the world.
- gregorian
- Chinese translation of the Gregorian calendar.
- length
- Length measures.
- weight
- Weight measures.
Macros§
- chinese_
vec - Creates ChineseVec instances with elegant simplicity.
- define_
count_ measure - Defines a struct implementing Measure having a Count value.
- define_
measure - Defines a struct implementing Measure.
- define_
multi_ register_ measure - Defines a Measure having both a formal and an informal unit.
- define_
no_ copy_ measure - Like define_measure, but the generated struct is not Copy.
- define_
string_ placeholder - Defines a new placeholder type.
Structs§
- Chinese
- Chinese expression.
- Chinese
Vec - A vector containing Chinese expressions.
- Count
- Integer quantity expressing the result of a counting process.
- Decimal
- Accurate real number.
- Empty
Placeholder - Placeholder replacing an omissible value with an empty string.
- Financial
- Financial numbers designed to prevent falsification.
- Fraction
- A fraction, convertible to Chinese.
- Left
Padder - Pads by adding the given logogram to the left.
- Ling
Placeholder - Placeholder replacing an omissible value with
零
. - Sign
- Sign of a number.
- Zero
Denominator - Error for when a denominator is zero.
Enums§
- Variant
- The two major Chinese variants.
Traits§
- Chinese
Format - Trait expressing support for infallible conversion to Chinese.
- Measure
- Trait describing a value combined with a unit of measurement.
Type Aliases§
- Count
Base - The integer type on which Count is based.
- Financial
Base - The integer type on which Financial is based.
- Generic
Result - The most generic Error-based Result.
- Integer
Part - The integer part of a Decimal.