/std/num/index.nct
index.nct
//! Decimal integer parsing and text conversion.
use /mem.TryAllocator
use /string.String
see ./decimal.nct
see ./scalar.nct
see ./tests.nct
see ./text.nct
/// Boolean truth value.
pub primitive type bool
/// Signed 8-bit integer.
pub primitive type i8
/// Signed 16-bit integer.
pub primitive type i16
/// Signed 32-bit integer.
pub primitive type i32
/// Signed 64-bit integer.
pub primitive type i64
/// Unsigned 8-bit integer.
pub primitive type u8
/// Unsigned 16-bit integer.
pub primitive type u16
/// Unsigned 32-bit integer.
pub primitive type u32
/// Unsigned 64-bit integer.
pub primitive type u64
/// Pointer-sized unsigned integer.
pub primitive type usize
/// Pointer-sized signed integer.
pub primitive type isize
construct i8 {
/// Parses one complete signed decimal integer.
pub noalloc func parse(text: &str): Self?
}
construct i16 {
/// Parses one complete signed decimal integer.
pub noalloc func parse(text: &str): Self?
}
construct i32 {
/// Parses one complete signed decimal integer.
pub noalloc func parse(text: &str): Self?
}
construct i64 {
/// Parses one complete signed decimal integer.
pub noalloc func parse(text: &str): Self?
}
construct isize {
/// Parses one complete signed decimal integer.
pub noalloc func parse(text: &str): Self?
}
construct u8 {
/// Converts a value when it is representable as `u8`.
pub noalloc func checked(value: u64): Self?
/// Keeps the low eight bits of a value.
pub noalloc func truncate(value: u64): Self
/// Parses one complete unsigned decimal integer.
pub noalloc func parse(text: &str): Self?
}
construct u16 {
/// Parses one complete unsigned decimal integer.
pub noalloc func parse(text: &str): Self?
}
construct u32 {
/// Parses one complete unsigned decimal integer.
pub noalloc func parse(text: &str): Self?
}
construct u64 {
/// Parses one complete unsigned decimal integer.
pub noalloc func parse(text: &str): Self?
}
construct usize {
/// Parses one complete unsigned decimal integer.
pub noalloc func parse(text: &str): Self?
}
instance i8 {
/// Returns the shortest ordinary decimal spelling.
pub method self.to_string(): String
/// Returns the same spelling using a recoverable allocator.
pub method self.try_to_string(allocator: &+TryAllocator): String! from allocator
}
instance i16 {
/// Returns the shortest ordinary decimal spelling.
pub method self.to_string(): String
/// Returns the same spelling using a recoverable allocator.
pub method self.try_to_string(allocator: &+TryAllocator): String! from allocator
}
instance i32 {
/// Returns the shortest ordinary decimal spelling.
pub method self.to_string(): String
/// Returns the same spelling using a recoverable allocator.
pub method self.try_to_string(allocator: &+TryAllocator): String! from allocator
}
instance i64 {
/// Returns the shortest ordinary decimal spelling.
pub method self.to_string(): String
/// Returns the same spelling using a recoverable allocator.
pub method self.try_to_string(allocator: &+TryAllocator): String! from allocator
}
instance isize {
/// Returns the shortest ordinary decimal spelling.
pub method self.to_string(): String
/// Returns the same spelling using a recoverable allocator.
pub method self.try_to_string(allocator: &+TryAllocator): String! from allocator
}
instance u64 {
/// Adds two values modulo 2^64.
pub noalloc method self.wrapping_add(other: u64): u64
/// Multiplies two values modulo 2^64.
pub noalloc method self.wrapping_mul(other: u64): u64
/// Returns the bitwise exclusive OR of two values.
pub noalloc method self.bit_xor(other: u64): u64
/// Rotates the bits right; only the low six bits of amount are significant.
pub noalloc method self.rotate_right(amount: u64): u64
/// Returns the shortest ordinary decimal spelling.
pub method self.to_string(): String
/// Returns the same spelling using a recoverable allocator.
pub method self.try_to_string(allocator: &+TryAllocator): String! from allocator
}
instance u8 {
/// Returns the shortest ordinary decimal spelling.
pub method self.to_string(): String
/// Returns the same spelling using a recoverable allocator.
pub method self.try_to_string(allocator: &+TryAllocator): String! from allocator
}
instance u16 {
/// Returns the shortest ordinary decimal spelling.
pub method self.to_string(): String
/// Returns the same spelling using a recoverable allocator.
pub method self.try_to_string(allocator: &+TryAllocator): String! from allocator
}
instance u32 {
/// Returns the shortest ordinary decimal spelling.
pub method self.to_string(): String
/// Returns the same spelling using a recoverable allocator.
pub method self.try_to_string(allocator: &+TryAllocator): String! from allocator
}
instance usize {
/// Returns the shortest ordinary decimal spelling.
pub method self.to_string(): String
/// Returns the same spelling using a recoverable allocator.
pub method self.try_to_string(allocator: &+TryAllocator): String! from allocator
}