A typesafe, flexible, simple, and user-friendly unit system library for Rust that has good error messages.

Overview

uy

A typesafe, flexible, simple, and user-friendly unit system library for Rust that has good error messages.

Usage

uy not only stores the unit of a value in the typesystem, it also stores the scale within the unit's type itself.

For example, Quantity<f32, si::m> is not the same type as Quantity<f32, si::kilo<si::m>>.

To convert between types like that, call the .convert() method on Quantity.

Example

use uy::{Quantity, si};

fn how_long(
    d: Quantity<f32, si::m>,
    v: Quantity<f32, uy::Div<si::m, si::s>>
) -> Quantity<f32, si::s> {
    d / v
}
You might also like...
A fast and flexible LRU map.

A fast and flexible LRU map This repository contains a fast and flexible LRU map. Blazingly fast. Up to twice as fast as the lru crate, and with less

Stack heap flexible string designed to improve performance for Rust

flexible-string A stack heap flexible string designed to improve performance. FlexibleString was first implemented in spdlog-rs crate, which improved

A flexible, stateless implementation of the bisection method

Flexibility is achieved by giving the user of this crate control over the input and output types

🤩 Flexible interpreted programming language

Jel Flexible, memory-safe, easy-to-use, interpreted programming language. work in progress Example Hello World: print(Hello World!) # this is valid pr

RcLite: small, fast, and memory-friendly reference counting for Rust

RcLite: small, fast, and memory-friendly reference counting RcLite is a lightweight reference-counting solution for Rust that serves as an alternative

Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study
Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

Human-friendly indexed collections

Indexical: Human-Friendly Indexed Collections Indexical is a library for conveniently and efficiently working with indexed collections of objects. "In

Checks Crusader Kings 3 user mod files for common mistakes and warns about them.

ck3-tiger Pounces on bugs. Checks Crusader Kings 3 user mod files for common mistakes and warns about them. For example: missing localizations, or usi

Featured Dioxus projects on how to build clean user interfaces in Rust
Featured Dioxus projects on how to build clean user interfaces in Rust

Example projects with Dioxus This repository holds the code for a variety of example projects built with Dioxus. Each project has information on how t

Comments
  • Hash disregards units

    Hash disregards units

    Currently, hash is implemented like this:

    impl<T: hash::Hash, U: Unit> hash::Hash for Quantity<T, U> {
        fn hash<H: hash::Hasher>(&self, state: &mut H) {
            self.val.hash(state);
        }
    }
    

    which disregards units (i.e. 1kg would have the same hash as 1Hz).

    opened by Indy2222 0
Owner
Lachlan Sneff
Lachlan Sneff
derive(Code) simplifies error handling by providing an easy-to-use enumeration of error codes

enum-code Introduction enum-code is a derive macro for enum types. This library generates code that associates error codes with error types. It can be

Bay 5 Jun 14, 2023
Texting Robots: A Rust native `robots.txt` parser with thorough unit testing

Texting Robots Crate texting_robots is a library for parsing robots.txt files. A key design goal of this crate is to have a thorough test suite tested

Stephen Merity 20 Aug 17, 2022
A developer-friendly framework for building user interfaces in Rust

Reading: "Fru" as in "fruit" and "i" as in "I" (I am). What is Frui? Frui is a developer-friendly UI framework that makes building user interfaces eas

Frui Framework 1.1k Jan 8, 2023
This experiment shows connecting wasm-bindgen generated code to a good-web-game application.

GWG + wasm-bindgen example This experiment shows connecting wasm-bindgen generated code to a good-web-game application. It uses simple_logger crate to

Tomasz Sterna 1 May 12, 2021
Fluent assertion library for Rust with readable messages.

Assertor Assertor makes test assertions and failure messages more human-readable. Assertor is heavily affected by Java Truth in terms of API design an

Google 20 Dec 12, 2022
Grimsby is an Erlang Port written in Rust that can close its standard input while retaining standard output (and error)

Grimsby An Erlang Port provides the basic mechanism for communication from Erlang with the external world. From the Ports and Port Drivers: Erlang Ref

Peter Morgan 5 May 29, 2023
🚃 lib for CLI utilities, printing, and error handling

axocli Common code for setting up a CLI App and handling errors/printing. Example See examples/axoapp.rs for a walkthrough/example. Some various inter

axo 5 Apr 4, 2023
A tray application for Windows that gives you push notifications and instant downloads of new posts, messages and stories posted by models you subscribe to on Onlyfans.

OF-notifier A tray application for Windows that gives you push notifications and instant downloads of new posts, messages and stories posted by models

Gentlemen Mercenary 10 Dec 20, 2022
Rust-idiomatic, compliant, flexible and performant BIP21 crate

Rust implementation of BIP21 Rust-idiomatic, compliant, flexible and performant BIP21 crate. About Important: while lot of work went into polishing th

Martin Habovštiak 6 Dec 15, 2022
A backend framework for building fast and flexible APIs rapidly.

Andromeda Andromeda is a backend framework for Rust, to simplify the development of the kinds of basic API services that we developers have to build s

Framesurge 7 Dec 28, 2022