#integer #numeral #numbers #format

kaktovik

Format a number in Kaktovik numerals

8 releases

Uses new Rust 2024

0.2.2 Jan 5, 2026
0.2.1 Jan 5, 2026
0.1.4 Apr 30, 2023

#193 in Value formatting

MIT license

14KB
196 lines

A library for managing Kaktovik Iñupiaq numerals.

Kaktovik numerals are a base-20 system used by the Iñupiat of Alaska. This crate allows for parsing, formatting, and arithmetic operations on these numerals, backed by standard Rust usize integers.

Features

  • Zero-allocation parsing: Uses efficient arithmetic for parsing.
  • Zero-allocation formatting: Uses stack buffers for displaying numbers.
  • Serde support: Serializes directly to Kaktovik strings.

Examples

use kaktovik::Numeral;

fn main() {
    // Parse a Kaktovik string (20 + 2 = 22)
    let n: Numeral = "𝋁𝋂".parse().unwrap();
    assert_eq!(n.to_usize(), 22);
    
    // Arithmetic
    let sum = n + Numeral::new(10);
    assert_eq!(sum.to_usize(), 32);
    
    // Formatting
    println!("The number is: {sum}");
}

Dependencies

~0.5–1.4MB
~29K SLoC