numberwang

Crates.ionumberwang
lib.rsnumberwang
version0.1.0
sourcesrc
created_at2024-11-08 08:12:44.831842
updated_at2024-11-08 08:12:44.831842
descriptionLibrary of custom number malarkey, including variable-bit-width integers
homepage
repositoryhttps://github.com/danwilliams/numberwang
max_upload_size
id1440983
size200,071
Dan Williams (danwilliams)

documentation

https://docs.rs/numberwang

README

Numberwang

The Numberwang crate is a library of custom number types and functionality, including variable-bit-width integers.

It is named after the fictitious game show "Numberwang", which is a running joke in the British sketch comedy show That Mitchell and Webb Look. The name was chosen because the crate is all about numbers.

The modules provided are:

int

The int module provides a variable-bit-width integer type, Int, which can be used to store integers of any bit width, from 1 to 65,536 bits.

This is particularly useful for situations such as:

  • Database compatibility: This type can be used to create an unsigned 63-bit integer to represent the crossover between a [u64] (which would be the choice for the types used in Rust) and an [i64] (which is a limitation of certain databases, e.g. PostgreSQL). This is necessary in order to safely represent the values in the database without losing any information.

  • Efficiency: This type is also useful for efficiency, as it can be used to create integers that only take the space they need between the standard sizes, e.g. 24-bit, 48-bit, etc.

  • Higher boundaries: This type can also be used to create integers with higher boundaries than the standard Rust integer types, e.g. 256-bit, 512-bit, etc. all the way up to 65,536-bit.

The type implements all standard Rust functionality for integers, and follows standard Rust conventions, meaning it should be intuitive to use. It also correctly observes Endian rules and interoperability, in terms of both bits and bytes.

Commit count: 16

cargo fmt