lib-misc-utils · crate

num-traits

Libraryenvironment

Kinogaki's own numeric traits, published under the crates.io name num-traits so the frozen naga and our half resolve to it through [patch.crates-io].

Repository
lib-misc-utils (kinogaki/lib-misc-utils)
Folder
libs/lib-misc-utils/crates/num-traits
Source
9 files, 1,179 lines
Tests
1 file, 86 lines
depends onused by tests alonedependencies for tests alone are listed below, not drawn

What it is

Kinogaki's own numeric traits, published under the crates.io name num-traits so the frozen naga and our half resolve to it through [patch.crates-io]. It is not upstream num-traits: it holds only the traits and methods those two crates call, implemented for the primitive types with std's float functions.

The conversions follow num-traits' documented rules, which naga's constant evaluator depends on:

  • float to integer truncates toward zero and is None when the truncated value does not fit (or the float is NaN or infinite);
  • integer to float rounds to nearest, ties to even (Rust's as);
  • float to float is Rust's as (finite values may overflow to infinity).

Depends on

None.

Third-party

None.

Used by

CrateRepositoryAsWhat it is
halflib-misc-utilsnormalKinogaki's own half, published under the crates.io name so the frozen naga resolves to it through [patch.crates-io].

Third-party crates using it

naga

Modules

Public types and traits

At the crate root

Traits AsPrimitiveBoundedCheckedAddCheckedDivCheckedMulCheckedNegCheckedSubFloatFloatConstFloatCoreFromPrimitiveNumNumCastOnePrimIntSignedToPrimitiveWrappingAddWrappingMulWrappingNegWrappingSubZero

By module: 22 public types and traits in 8 modules

bounds Bounded

cast AsPrimitiveFromPrimitiveNumCastToPrimitive

float FloatFloatConstFloatCoreReal

identities OneZero

int PrimInt

ops::checked CheckedAddCheckedDivCheckedMulCheckedNegCheckedSub

ops::wrapping WrappingAddWrappingMulWrappingNegWrappingSub

sign Signed

Besides these, 3 public functions at module level.