rokdocs
v0.1

rok::core::num

rok::core::num - the primitive types' operator / comparison trait impls (stdlib spec 2.1, 2.3.5, 2.5). They make T: Add / T: Ord bounds accept primitives. Each method is #[intrinsic("rok.OP.TYPE")] (stdlib spec 0.3): a primitive a + b and a by-name call (x.add(y), T::add(a, b)) both lower to the machine op. The body is the fallback (0.3.4) and what a fn value of the method runs. One block per (type, trait); keep it regular. The inherent methods (checked_add, count_ones, floor, ..) live in ints / floats.

Modules

  • ints rok::core::num::ints: the integer primitives' methods and limits (stdlib 2.1.4): bit operations, byte order, and the `checked_` / `wrapping_` / `saturating_` / `overflowing_` families that spell out what plain `+ - *` leave to the profile (2.3).
  • floats rok::core::num::floats - `f32` / `f64` inherent methods and constants (stdlib spec 2.1.4).
  • bigint rok::core::num::bigint: `int`, the arbitrary-precision integer (stdlib 2.1.2, 2.1.6, 2.1.7).
  • bigfloat rok::core::num::bigfloat: `float` (stdlib 2.1.3).
  • niche rok::core::num::niche - wrappers that leave out values (stdlib spec 2.2): `NonZero<T>` (0), `NonNan<F>` (NaN), `Finite<F>` (NaN, ±∞), `Positive<T>` (negatives; refs-lang 2.7.6).
  • assign rok::core::num::assign - the `*Assign` impls (stdlib 2.4.6) of the primitives, `int` / `float` and `str`.

Traits

Zero

pub trait Zero

The additive identity - where Iterator::sum starts (an empty sum is 0).

  • fn zero() -> Self

One

pub trait One

The multiplicative identity - where Iterator::product starts.

  • fn one() -> Self