use-catalan
Install
[]
= "0.0.1"
Foundation
use-catalan provides a deliberately small exact-counting surface for Catalan-family sequences. The crate currently exposes catalan(n) for standard Catalan numbers and fuss_catalan(order, n) for the generalized Fuss-Catalan family. Results stay in checked u128 arithmetic, and overflow or invalid order values surface as explicit CatalanError values.
| Helper group | Primary items | Best fit |
|---|---|---|
| Standard Catalan | catalan, CatalanError |
Exact counts for binary-tree, Dyck-word, and balanced-parenthesization style problems |
| Generalized Catalan | fuss_catalan |
Wider Catalan-family counts without a broader sequence toolbox |
When to use directly
Choose use-catalan directly when Catalan-family sequence helpers are the only surface you need and you want to keep that concern explicit and narrow.
| Scenario | Use use-catalan directly? |
Why |
|---|---|---|
| You only need exact Catalan counts | Yes | The crate stays smaller than the facade and keeps the counting domain explicit |
| You need generalized Fuss-Catalan counts alongside standard Catalan numbers | Yes | The current surface already covers both without a broader sequence abstraction |
| You also need combinatorics, geometry, or other math domains | Usually no | use-math can unify the concrete surfaces behind feature flags |
Scope
- The current surface is intentionally small and concrete.
- Sequence values use checked
u128arithmetic and return explicit errors at the boundary. - General combinatorics helpers and broader sequence APIs belong in adjacent focused crates.
Examples
Standard Catalan numbers
use catalan;
assert_eq!;
assert_eq!;
# Ok::
Generalized Fuss-Catalan numbers
use fuss_catalan;
assert_eq!;
assert_eq!;
# Ok::
Status
use-catalan is a concrete pre-1.0 crate in the RustUse docs surface. The API remains intentionally small while adjacent sequence and combinatorics crates continue to grow around it.