Rust library of custom number malarkey, including variable-bit-width integers

Overview

Numberwang

Rust Crate version CI Docs License

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.

You might also like...
Bitpack a boolean into a pointer using bit magic.

ptr-bool tl;dr: a pointer and boolean with the same size as a pointer. A convenience crate used to bitpack a boolean and pointer into the same eight b

probe-run is a custom Cargo runner that transparently runs Rust firmware on an embedded device

probe-run Runs embedded programs just like native ones probe-run is a custom Cargo runner that transparently runs Rust firmware on an embedded device.

Custom formatting for Rust.

custom-format This crate extends the standard formatting syntax with custom format specifiers, by providing custom formatting macros. It uses : (a spa

Custom deserialization for fields that can be specified as multiple types.

serde-this-or-that Custom deserialization for fields that can be specified as multiple types. This crate works with Cargo with a Cargo.toml like: [dep

proc-macro to help with using surrealdb's custom functions

SurrealDB Functions This is a proc-macro crate that given a path to a .surql file or a folder of .surql files, will parse DEFINE FUNCTION fn::s inside

Create custom ID types that are guaranteed to be valid `RecordID` in SurrealDB

surreal-id The surreal-id crate offers a standardized way to create and validate IDs in your application for usage with SurrealDB. Using the NewId tra

Rust 核心库和标准库的源码级中文翻译,可作为 IDE 工具的智能提示 (Rust core library and standard library translation. can be used as IntelliSense for IDE tools)

Rust 标准库中文版 这是翻译 Rust 库 的地方, 相关源代码来自于 https://github.com/rust-lang/rust。 如果您不会说英语,那么拥有使用中文的文档至关重要,即使您会说英语,使用母语也仍然能让您感到愉快。Rust 标准库是高质量的,不管是新手还是老手,都可以从中

A library for extracting #[no_mangle] pub extern "C" functions (https://docs.rust-embedded.org/book/interoperability/rust-with-c.html#no_mangle)

A library for extracting #[no_mangle] pub extern "C" functions In order to expose a function with C binary interface for interoperability with other p

Rust Imaging Library: A high-level Rust imaging crate.

ril Rust Imaging Library: A performant and high-level Rust imaging crate. Documentation • Crates.io • Discord What's this? This is a Rust crate design

Releases(v0.1.0)
  • v0.1.0(Nov 8, 2024)

    Added

    • Added int module to provide custom-bit-width integers
      • Added Int type with full set of functionality
    • Added unit tests for arbitrary u63 example type
    • Added README documentation
    Source code(tar.gz)
    Source code(zip)
Owner
Dan Williams
Enthusiastic Rustacean 🦀 Polyglot with 30+ years of experience across multiple languages and stacks.
Dan Williams
A turing-complete programming language using only zero-width unicode characters, inspired by brainfuck and whitespace.

Zero-Width A turing-complete programming language using only zero-width unicode characters, inspired by brainfuck and whitespace. Currently a (possibl

Gavin M 2 Jan 14, 2022
📈 The fastest map possible in Rust, where keys are integers and the capacity is fixed (faster than Vec!)

It is an alternative on-heap implementation of a map with keys of type usize and a fixed capacity. It works much faster than a standard HashMap becaus

Yegor Bugayenko 6 Apr 26, 2023
Rust implementations of finite-field arithmetic based on big integers with configurable limb sizes

multiprecision TODO: rewrite readme implement CIOS for 16-bit limbs All operations are in little-endian form (where the digit in memory at the smalles

Geometry 4 Mar 30, 2024
A cargo subcommand to fetch the $OUT_DIR environment variable from build scripts

cargo-outdir A cargo subcommand to fetch the $OUT_DIR variable from build scripts. This is extremely useful to inspect the output of automatically gen

null 2 Sep 29, 2022
Tool to convert variable and function names in C/C++ source code to snake_case

FixNameCase Tool to convert variable and function names in C/C++ source code to snake_case. Hidden files and files listed in .gitignore are untouched.

AgriConnect 4 May 25, 2023
alto provides idiomatic Rust bindings for OpenAL 1.1 and extensions (including EFX).

alto alto provides idiomatic Rust bindings for OpenAL 1.1 and extensions (including EFX). WARNING Because Alto interacts with global C state via dynam

null 80 Aug 7, 2022
📘 Utilities for the Fibonacci Number and Sequence

Fibora Port of fibonacci-deno for Rust. Utilities for the Fibonacci Number and Sequence. Usage This package exposes two Functions, fibonacci and fibon

Eliaz Bobadilla 5 Apr 6, 2022
A bit-packed k-mer representation (and relevant utilities) for rust

K-mer class for rust The purpose of this repository is to build a simple library that exposes a bit-packed k-mer class for use in rust-based bioinform

COMBINE lab 41 Dec 15, 2022
Simple bit-level protocol definitions in Rust.

bin-proto Simple & fast structured bit-level binary co/dec in Rust. An improved and modernized fork of protocol. A more efficient but (slightly) less

null 16 Jun 13, 2024
Isn't it time to be a bit nicer to rustc?

politeness-macro Aren't we all too rude to computers? Isn't it time to bring a bit more politeness into our programming? Shouldn't we be a bit nicer t

Rin 6 Mar 11, 2022