GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - AldaronLau/ranch: Rust library providing ranged types and math for integers, floats, and durations

BranchesTags
Open more actions menu

Latest commit

 

History

180 Commits
180 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE_APACHE
LICENSE_APACHE
 
 
LICENSE_BOOST
LICENSE_BOOST
 
 
LICENSE_MIT
LICENSE_MIT
 
 
README.md
README.md
 
 
clippy.toml
clippy.toml
 
 
rustfmt.toml
rustfmt.toml
 
 

Repository files navigation

Ranch

tests GitHub commit activity GitHub contributors
Crates.io Crates.io Crates.io (recent)
Crates.io Docs.rs

Rust library providing ranged types and math for integers, floats, and durations

Do you ever need to restrict a u8 from 0 to 100 or restrict any other integer type to any other range? Then this crate is for you! The ranges are encoded in the type system, so you only need to validate the range once (and it can even be at compile time!). This crate is sort of like a combination of similar crates deranged and ux.

This crate heavily leverages the type system to allow for powerful ranged integer mathematics, covering arbitrary i{N} / u{N} types, unit integers, non-zero divisions, and const operations. Enable the serde feature for range-validated deserialization / serialization (implements Serialize and Deserialize for Ranged* types).

Check out the documentation for examples.

Features

  • Compile-time and runtime checked constructors for ranged integers
  • Strict, checked, saturating, constant, and ranged operations
  • Conversions between for ranged integers
  • Aliases for arbitrary width integers, unit integers, and ASCII types
  • Optional crate support
    • Enable arbitrary for generating ranged integers from raw fuzzing data
    • Enable bitflags for using ranch::bitwise types as bitflags
    • Enable bytemuck for casting as "plain old data"
    • Enable fastrand for RNG support
    • Enable rand.v010 for using with the rand crate
    • Enable serde for serialization and deserialization
    • Enable zeroize for secure secret clearing

MSRV

The current MSRV is Rust 1.91.

Any future MSRV updates will follow the Ardaku MSRV guidelines.

License

Copyright © 2025-2026 The Ranch Contributors.

Licensed under any of

  • Apache License, Version 2.0, (LICENSE_APACHE or https://www.apache.org/licenses/LICENSE-2.0)
  • Boost Software License, Version 1.0, (LICENSE_BOOST or https://www.boost.org/LICENSE_1_0.txt)
  • MIT License, (LICENSE_MIT or https://mit-license.org/)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as described above, without any additional terms or conditions.

AI / LLM (Non-)Usage

This project was developed without using AI tooling. AI usage for contributions is strictly banned, with the exception of AI tooling trained on exclusively CC0, Unlicense, or equivalently-licensed code. By opening a PR on this repository, you assert that the work (excluding any test data) is either human generated, computer generated trained on works in the public domain, or a combination of the two. AI bug reports are welcome as issues, as long as there is a disclaimer that it was discovered with AI.

Help

If you want help using or contributing to this library, feel free to send me an email at [email protected].

About

Rust library providing ranged types and math for integers, floats, and durations

docs.rs/ranch

Topics

compile-time-checkingconst-genericsinteger-programmingintegersmathematicsparsingrangedranged-integersrangesrustrust-libraryrust-patternsunalignedvalue-validation

Resources

Readme

Code of conduct

Code of conduct

Contributing

Contributing
Activity

Stars

3 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

Generated from AldaronLau/library-template
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.