Crate kaktovik

Crate kaktovik 

Source
Expand description

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;

// 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}");

Structs§

Numeral
A wrapper around usize representing a number displayed in Kaktovik numerals.

Enums§

ParseError
Errors that can occur when parsing Kaktovik numerals.

Constants§

DIGITS
The standard array of Kaktovik numerals from 0 to 19.