Expand description
§use-series
Small arithmetic and geometric progression helpers for `RustUse`.
Exact checked nth-term and partial-sum helpers for common progression workflows.
§Install
[dependencies]
use-series = "0.0.1"§Foundation
use-series provides a deliberately small exact progression surface. The crate currently exposes zero-based arithmetic and geometric nth-term helpers plus checked partial sums over signed i128 values. Overflow remains explicit through SeriesError rather than relying on panics or silently widening into floating-point behavior.
Arithmetic progression helpersarithmetic_nth_term and arithmetic_sum cover exact linear progressions with signed steps.
|
Geometric progression helpersgeometric_nth_term and geometric_sum cover exact signed-ratio progressions.
|
Explicit overflowSeriesError reports the operation that overflowed instead of hiding arithmetic limits.
|
| Helper group | Primary items | Best fit |
|---|---|---|
| Arithmetic progressions | arithmetic_nth_term, arithmetic_sum | Linear sequences, step-based schedules, and exact partial sums |
| Geometric progressions | geometric_nth_term, geometric_sum | Exponential growth or decay with exact signed ratios |
§When to use directly
Choose use-series directly when sequence and series helpers are the only surface you need and you want to keep that concern narrower than the full facade crate.
| Scenario | Use use-series directly? | Why |
|---|---|---|
| You only need arithmetic or geometric progression helpers | Yes | The crate stays smaller than the facade and keeps progression arithmetic explicit |
| You want exact signed partial sums without floating-point rounding | Yes | The current surface is checked and stays in i128 |
| You also need combinatorics, geometry, or other math domains | Usually no | use-math can unify the concrete surfaces behind features |
§Scope
- The current surface is intentionally small and concrete.
- Progression helpers stay function-oriented instead of introducing wrapper types without extra invariants.
- Catalan-family sequences and calculus-specific analysis helpers belong in adjacent focused crates.
§Examples
§Arithmetic progressions
use use_series::{arithmetic_nth_term, arithmetic_sum};
assert_eq!(arithmetic_nth_term(3, 2, 4)?, 11);
assert_eq!(arithmetic_sum(3, 2, 5)?, 35);
§Geometric progressions
use use_series::{geometric_nth_term, geometric_sum};
assert_eq!(geometric_nth_term(2, 3, 4)?, 162);
assert_eq!(geometric_sum(2, 3, 4)?, 80);
§Status
use-series is a concrete pre-1.0 crate in the RustUse docs surface. The API remains intentionally small while broader sequence and analysis crates continue to grow around it.
Series utilities for RustUse.
Re-exports§
pub use error::SeriesError;pub use progression::arithmetic_nth_term;pub use progression::arithmetic_sum;pub use progression::geometric_nth_term;pub use progression::geometric_sum;
Modules§
- error
- prelude
- Common ergonomic imports for
use-series. - progression