hco_rust
hco_rust is a small Rust utility library focused on math helpers, container/data-structure experiments, and simple number-to-language conversion tools.
The crate is still early-stage and intended primarily for study and exploration rather than production use. APIs may change between releases.
Highlights
- Math utilities such as fractions, digit representations, number-theory helpers, vectors, and numeric traits.
- Data-structure utilities such as interval sets, sorting helpers, ordered-search traits, and bounds-protection helpers.
- Natural-language number conversion experiments, currently including Chinese number rendering.
- Stable by default: nightly-only specialization behavior is behind an explicit
specializationfeature.
Installation
Add the crate to your Cargo.toml:
[]
= "0.0.2"
If you want the specialization-based implementations, enable the feature explicitly:
[]
= { = "0.0.2", = ["specialization"] }
The specialization feature requires a nightly compiler.
Module Overview
The public top-level modules are:
lib::math: numeric data types, algorithms, and math-related traits.lib::datas: container and interval-related data structures and helpers.lib::ntr_lang: number-to-language conversion traits and implementations.lib::tool: lightweight debug-print macros.
math
Notable submodules:
fraction: genericFraction<T>.digits: a base-awareDigitsrepresentation.num_theory: GCD implementations and related helpers.traits: numeric traits such as sign, additive/multiplicative identities, constants, and comparison helpers.vector,matrix,complex: experimental math structures.
datas
Notable submodules:
intervalandinterval_set: interval types and set-like interval storage.sort: merge sort and insertion sort helpers.ordered: traits for ordered collections.map,btree,bound_protect,array,ord_wrap: additional experimental utilities.traits: collection traits such asContains,Insert, andRemove.
ntr_lang
Notable submodules:
lang: core traits such asNumToLangParserandLanguageParser.chinese: Chinese number conversion support.
Examples
Digits
use ;
let digits = from_u64;
assert_eq!;
Fractions
use Fraction;
let a = new;
let b = new;
let c = a + b;
assert_eq!;
Chinese Number Rendering
use Digits;
use NumToLangParser;
use NumberToChineseParser;
let parser = default;
let text = parser.number_to_text.unwrap;
assert_eq!;
Features
specialization
Enables nightly-only specialization-based implementations for part of the comparison trait system.
- Default: disabled
- Compiler requirement when enabled: nightly Rust
- Intended use: experimentation with specialized trait behavior
Without this feature, the crate is intended to compile on stable Rust.
Project Notes
- This library currently favors clarity and experimentation over aggressive optimization.
- Some modules are more mature than others; behavior and naming may still evolve.
- The crate name published on crates.io is currently
lib, so imports use paths such aslib::math::digits::Digits.
Development
Useful local commands:
License
Licensed under the Apache License, Version 2.0. See LICENSE.