API reference Dodo 0.1.4

core/num

Public declarations, types, methods, and source contracts for core/num.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "core/num"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
mem core/mem num.dodo

MAX

Constant · Source

Pointer-sized resource arithmetic. Failures never trap or wrap implicitly.

pub const MAX: usize = ~0usize

MIN

Constant · Source

pub const MIN: usize = 0

ArithmeticError

Enum · Source

pub enum ArithmeticError {
    Overflow, DivisionByZero, InvalidShift, InvalidAlignment
}

checked_add

Function · Source

pub fn checked_add(a: usize, b: usize) -> Result<usize, ArithmeticError>

checked_sub

Function · Source

pub fn checked_sub(a: usize, b: usize) -> Result<usize, ArithmeticError>

checked_mul

Function · Source

pub fn checked_mul(a: usize, b: usize) -> Result<usize, ArithmeticError>

checked_div

Function · Source

pub fn checked_div(a: usize, b: usize) -> Result<usize, ArithmeticError>

checked_rem

Function · Source

pub fn checked_rem(a: usize, b: usize) -> Result<usize, ArithmeticError>

checked_shl

Function · Source

pub fn checked_shl(value: usize, shift: usize) -> Result<usize, ArithmeticError>

checked_shr

Function · Source

pub fn checked_shr(value: usize, shift: usize) -> Result<usize, ArithmeticError>

saturating_add

Function · Source

pub fn saturating_add(a: usize, b: usize) -> usize

saturating_sub

Function · Source

pub fn saturating_sub(a: usize, b: usize) -> usize

saturating_mul

Function · Source

pub fn saturating_mul(a: usize, b: usize) -> usize

wrapping_add

Function · Source

pub fn wrapping_add(a: usize, b: usize) -> usize

wrapping_sub

Function · Source

pub fn wrapping_sub(a: usize, b: usize) -> usize

wrapping_mul

Function · Source

pub fn wrapping_mul(a: usize, b: usize) -> usize

min

Function · Source

pub fn min(a: usize, b: usize) -> usize

max

Function · Source

pub fn max(a: usize, b: usize) -> usize

is_power_of_two

Function · Source

pub fn is_power_of_two(value: usize) -> bool

align_up

Function · Source

pub fn align_up(value: usize, alignment: usize) -> Result<usize, ArithmeticError>

Type to search all documentation.

Keyboard shortcuts

Search documentation
Ctrl K or /
Move through results
↑ ↓
Open selected result
Enter
Close a dialog
Esc
Show these shortcuts
?