Operations and constants for uint
max_value
min_value
eq
ord
- Interfaces used for comparison.eq of eq for T
num of num::num for T
ord of ord for T
times of iter::times for T
add
compl
- Computes the bitwise complementdiv
div_ceil
- Divide two numbers, return the result, rounded up.div_floor
- Divide two numbers, return the result, rounded down.div_round
- Divide two numbers, return the result, rounded to the closest integer.eq
from_str
- Parse a string to an intfrom_str_radix
- Parse a string as an unsigned integer.ge
gt
hash
- Produce a uint suitable for use in a hash tableis_negative
is_nonnegative
is_nonpositive
is_positive
iterate
- Iterate over the range [lo
..hi
), or stop when requestedle
lt
max
min
mul
ne
next_power_of_two
- Returns the smallest power of 2 greater than or equal to n
parse_buf
- Parse a buffer of bytesrange
- Iterate over the range [lo
..hi
)rem
str
- Convert to a stringsub
to_str
- Convert to a string in a given baseto_str_bytes
- Low-level helper routine for string conversion.max_value
T
min_value
T
eq
eq
fn eq(&&other: self) -> bool
ord
Interfaces used for comparison.
lt
fn lt(&&other: self) -> bool
eq of eq for T
eq
fn eq(&&other: T) -> bool
num of num::num for T
add
fn add(&&other: T) -> T
sub
fn sub(&&other: T) -> T
mul
fn mul(&&other: T) -> T
div
fn div(&&other: T) -> T
modulo
fn modulo(&&other: T) -> T
neg
fn neg() -> T
to_int
fn to_int() -> int
from_int
fn from_int(n: int) -> T
ord of ord for T
lt
fn lt(&&other: T) -> bool
times of iter::times for T
times
fn times(it: fn() -> bool)
A convenience form for basic iteration. Given a variable x
of any numeric type, the expression for x.times { /* anything */ }
will execute the given function exactly x times. If we assume that x
is an int, this is functionally equivalent to for int::range(0, x) |_i| { /* anything */ }
.
add
pure fn add(&&x: T, &&y: T) -> T
compl
pure fn compl(i: T) -> T
Computes the bitwise complement
div
pure fn div(&&x: T, &&y: T) -> T
div_ceil
pure fn div_ceil(x: uint, y: uint) -> uint
Divide two numbers, return the result, rounded up.
The smallest integer q
such that x/y <= q
.
div_floor
pure fn div_floor(x: uint, y: uint) -> uint
Divide two numbers, return the result, rounded down.
Note: This is the same function as div
.
The smallest integer q
such that x/y <= q
. This is either x/y
or x/y + 1
.
div_round
pure fn div_round(x: uint, y: uint) -> uint
Divide two numbers, return the result, rounded to the closest integer.
The integer q
closest to x/y
.
eq
pure fn eq(&&x: T, &&y: T) -> bool
from_str
fn from_str(s: str) -> option<T>
Parse a string to an int
from_str_radix
fn from_str_radix(buf: str, radix: u64) -> option<u64>
Parse a string as an unsigned integer.
ge
pure fn ge(&&x: T, &&y: T) -> bool
gt
pure fn gt(&&x: T, &&y: T) -> bool
hash
pure fn hash(&&x: uint) -> uint
Produce a uint suitable for use in a hash table
is_negative
pure fn is_negative(x: T) -> bool
is_nonnegative
pure fn is_nonnegative(x: T) -> bool
is_nonpositive
pure fn is_nonpositive(x: T) -> bool
is_positive
pure fn is_positive(x: T) -> bool
iterate
fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool
Iterate over the range [lo
..hi
), or stop when requested
true
to continue, false
to stop.true
If execution proceeded correctly, false
if it was interrupted, that is if it
returned false
at any point.
le
pure fn le(&&x: T, &&y: T) -> bool
lt
pure fn lt(&&x: T, &&y: T) -> bool
max
pure fn max(&&x: T, &&y: T) -> T
min
pure fn min(&&x: T, &&y: T) -> T
mul
pure fn mul(&&x: T, &&y: T) -> T
ne
pure fn ne(&&x: T, &&y: T) -> bool
next_power_of_two
fn next_power_of_two(n: uint) -> uint
Returns the smallest power of 2 greater than or equal to n
parse_buf
fn parse_buf(buf: ~[u8], radix: uint) -> option<T>
Parse a buffer of bytes
buf
must not be empty
range
fn range(lo: T, hi: T, it: fn(T) -> bool)
Iterate over the range [lo
..hi
)
rem
pure fn rem(&&x: T, &&y: T) -> T
str
fn str(i: T) -> str
Convert to a string
sub
pure fn sub(&&x: T, &&y: T) -> T
to_str
fn to_str(num: T, radix: uint) -> str
Convert to a string in a given base
Fails if radix
< 2 or radix
> 16
to_str_bytes
fn to_str_bytes<U>(neg: bool, num: T, radix: uint, f: fn(v: & [u8]) -> U) -> U
Low-level helper routine for string conversion.