Crate based

Source
Expand description

§based

based provides support for custom single-character digits.

based does not support multi-character digits.

§Examples

use based::{Base, NumeralSystem};

let base16: Base = "0123456789abcdef".parse().unwrap();
let val: usize = base16.decode("10").unwrap();
assert_eq!(val, 16);
assert_eq!(base16.encode(16 as usize).unwrap(), "10")

Structs§

Base
Base represents a numeral system with single-character digits.
DuplicateCharacterError
DuplicateCharacterError is the error type produced when trying to create a Base from a string with at least one duplicate character.

Enums§

StrError
StrError is the error type produced when NumeralSystem::decode encounters an unknown character or fails to convert between two integer types.

Traits§

NumeralSystem
NumeralSystem provides conversions to and from representations in the given system.