Expand description
§chislo — числа прописью на русском языке
Convert numbers to Russian words (числа прописью) with correct grammatical gender and noun declension.
A Rust port of go-propisyu.
§Features
- Integers up to
i64::MAX(≈ 9.22 × 10^18); scale dictionary includes names up to 10^39 - Three grammatical genders: masculine, feminine, neuter
- Automatic Russian noun declension
- Ordinal numbers (“первый”, “сорок второй”)
- Currency formatting (“один рубль двадцать три копейки”)
- Decimal number support with configurable precision
no_stdcompatible (withalloc)
§Quick start
use chislo::{int_to_words, int_to_words_gender, decline, ordinal, Gender};
assert_eq!(int_to_words(42), "сорок два");
assert_eq!(int_to_words_gender(1, Gender::Feminine), "одна");
assert_eq!(decline(5, "рубль", "рубля", "рублей"), "рублей");
assert_eq!(ordinal(42, Gender::Masculine), "сорок второй");§Currency example
use chislo::{money, RUB};
assert_eq!(
money(1234, 56, &RUB),
"одна тысяча двести тридцать четыре рубля пятьдесят шесть копеек"
);Structs§
- Currency
- Gendered
Number - A number with a chosen grammatical gender.
- Money
Amount - A currency amount ready for formatting.
- Number
- A number with no fixed representation yet. Call one of the
.masculine(),.feminine(),.ordinal(...),.money(...)methods to get aDisplay-able wrapper. - Number
With Noun - A number paired with noun declension forms (“5 рублей”).
- Ordinal
Number - A number rendered as an ordinal (“сорок второй”).
Enums§
- Error
- Error type for number conversion.
- Gender
- Grammatical gender for Russian number words.
- Rounding
Mode
Constants§
Functions§
- date_
to_ words - Formats a full calendar date in Russian words (genitive day + month + year).
- decimal_
to_ words - Converts a decimal number string to Russian words (2 decimal places).
- decimal_
to_ words_ precision - Converts a decimal string with specified precision (1-9 decimal places).
- decimal_
value_ to_ words - Converts a
rust_decimal::Decimalvalue to Russian words (2 decimal places). - decimal_
value_ to_ words_ precision - Converts a
rust_decimal::Decimalvalue with the specified precision (1-9). - decline
- Returns the correct Russian noun declension form based on a number.
- duration_
from_ core - Formats a
core::time::Durationin Russian words (seconds precision). - duration_
from_ secs - Formats a duration given as a total number of seconds by splitting into days / hours / minutes / seconds.
- duration_
hms - Formats a duration given as hours, minutes, and seconds.
- fraction
- Formats an ordinary fraction with numerator and denominator as a Russian phrase like “одна вторая”, “три пятых”, “семь сотых”.
- hours_
word - Returns the Russian word form of “час/часа/часов” for the given count.
- int_
to_ words - Converts an integer to Russian words using masculine gender.
- int_
to_ words_ gender - Converts an integer to Russian words with the specified grammatical gender.
- minutes_
word - Returns the Russian word form of “минута/минуты/минут” for the given count.
- mixed_
fraction - Formats a mixed number: “две целых одна треть” style (one whole + fraction).
- money
- Formats an amount as words with currency.
- money_
from_ str - Parses an amount string and formats with currency.
- money_
from_ str_ rounded - Parses an amount string with the given rounding mode and formats it
as words with the specified currency. Accepts both
.and,as decimal separators. - month_
name - Returns the Russian name of the month in the nominative case (e.g. “апрель”).
- ordinal
- Converts a number to its ordinal form in Russian.
- percent
- Formats an integer percentage with the correct declension.
- percent_
decimal - Formats a decimal percentage with 2 fractional places in Russian words.
- percent_
decimal_ precision - Like
percent_decimalbut with a configurable precision (1–9 digits). - percent_
word - Returns the noun form “процент / процента / процентов” for the given count, without the number itself. Useful when you already have the number formatted and only need the word.
- seconds_
word - Returns the Russian word form of “секунда/секунды/секунд” for the given count.
- time_
to_ words - Formats wall-clock time in Russian words.
- year_
to_ words - Formats a year in the genitive masculine case, as used in Russian dates (e.g. “две тысячи двадцать шестого” for 2026).