std/prelude
Types
ByteBuffer
pub type ByteBuffer
Fixed-length bytes written in place, for building a Bytes or a String without a slot per byte; freezing hands the bytes over without a copy.
ByteBuffer.tryNew
pub pure fn ByteBuffer.tryNew(n: usize) -> Result[ByteBuffer, AllocError]
n zero bytes, or AllocError when the allocator refuses.
ByteBuffer.set
pub pure noalloc fn ByteBuffer.set(mut self, index: usize, b: u8)
Sets the byte at index; panics when index is past the end.
ByteBuffer.copyFrom
pub pure noalloc fn ByteBuffer.copyFrom(mut self, index: usize, src: Bytes, start: usize, end: usize)
Copies src[start..end] to the buffer at index; panics unless the range is within src and fits at index.
ByteBuffer.copyFromString
pub pure noalloc fn ByteBuffer.copyFromString(mut self, index: usize, src: String, start: usize, end: usize)
Same as copyFrom, from the bytes of a String.
ByteBuffer.freeze
pub pure noalloc fn ByteBuffer.freeze(move self) -> Bytes
The bytes, without a copy.
ByteBuffer.freezeString
pub pure noalloc fn ByteBuffer.freezeString(move self) -> String
The bytes as a String, without a copy; panics when they are not valid UTF-8.
FixedArray
pub type FixedArray[T, const N: usize]
Exactly N elements of T, stored inline with no heap buffer. a[i] traps when i is out of range; Copy, Eq and Hash follow T.
FixedArray.filled
pub pure fn FixedArray.filled[T: Copy, const N: usize](value: T) -> FixedArray[T, N]
N copies of value.
FixedArray.zeroed
pub pure fn FixedArray.zeroed[T: Copy + Zero, const N: usize]() -> FixedArray[T, N]
N zeros.
FixedArray.len
pub pure noalloc fn FixedArray[T, N].len(self) -> usize
Number of elements: always N, the type's own length.
FixedArray.get
pub pure fn FixedArray[T: Copy, N].get(self, index: usize) -> T?
A copy of the element at index, or None when index is out of range.
FixedArray.at
pub pure fn FixedArray[T, N].at[R](self, index: usize, f: fn(&T) -> R) -> R?
Calls f with a borrow of the element at index; None when out of range. Borrows cannot be returned (E220), hence the callback.
FixedArray.withMut
pub pure fn FixedArray[T, N].withMut[R](mut self, index: usize, f: fn(&mut T) -> R) -> R?
Calls f with an exclusive borrow of the element at index, so f can mutate it in place; None when index is out of range.
FixedArray.set
pub pure fn FixedArray[T, N].set(mut self, index: usize, value: T) -> Bool
Replaces the element at index with value; false when index is out of range instead of the trap a[i] = value has.
FixedArray.equals
pub pure fn FixedArray[T: Eq, N].equals(self, other: &FixedArray[T, N]) -> Bool
Element-wise equality; satisfies Eq when T does.
FixedArray.hash
pub pure fn FixedArray[T: Hash, N].hash(self) -> u64
Hash over the elements in order; satisfies Hash when T does.
FixedArray.toArray
pub pure fn FixedArray[T: Copy, N].toArray(self) -> Array[T]
A growable copy of the elements, in order.
FixedArray.fromArray
pub pure fn FixedArray.fromArray[T: Copy, const N: usize](a: &Array[T]) -> FixedArray[T, N]?
The elements of a, or None when its length is not N.
FixedArray.fromArrayMove
pub pure fn FixedArray.fromArrayMove[T, const N: usize](a: Array[T]) -> FixedArray[T, N]?
Moves a's elements in, or None (dropping a) when its length is not N; needs no Copy bound.
FixedArray.toBytes
pub pure fn FixedArray.toBytes[const N: usize](fa: FixedArray[u8, N]) -> Bytes
The N bytes of fa, in order. A static function under FixedArray for the same reason as Bytes.toFixed: no receiver binder can fix T to u8.
Overflow
pub type Overflow[T] = {
pub value T
pub overflowed Bool
}
Sum and whether it overflowed the width; unlike +, never panics.
Ordering
pub type Ordering = Less | Equal | Greater
Result of a three-way comparison.
Branch
pub type Branch[V, R] = Hit(V) | Miss(R)
Outcome of Fallback.branch: Hit carries the value, Miss what || passes to the fallback.
Out
pub type Out[T] = {
pub value T
}
One value out of an asm block.
Range
pub type Range[T] = {
pub start T
pub end T
pub inclusive Bool
}
start..end, half-open unless inclusive (start..=end).
AllocError
pub type AllocError = | OutOfMemory
Why an allocation was refused; carries no allocation itself.
AllocError.wrap
pub pure fn AllocError.wrap[T](value: T) -> Result[T, AllocError]
Ok(value), or AllocError when the allocator refuses the Result itself; the try* functions return through it so even their last allocation can fail.
Interfaces
Zero
pub interface Zero {
pure fn zero() -> Self
}
A type whose zero value is known statically, so zeroed can build a zero of an erased T.
Eq
@derivable
pub interface Eq {
pure fn equals(self, other: &Self) -> Bool
}
Equality; == and != call equals, except on f32 and f64, where they stay IEEE (NaN differs from itself) in generic code too, while equals is total. A record or ADT whose parts are all Eq gets a generated equals unless it defines one.
Hash
@derivable
pub interface Hash {
pure fn hash(self) -> u64
}
Hashing consistent with Eq; Map keys need both. A Copy record or ADT whose parts are all Hash gets a generated hash.
Ord
pub interface Ord {
pure fn compareTo(self, other: &Self) -> Ordering
}
Total order; <, <=, > and >= call compareTo, except on f32 and f64, where they stay IEEE (false against NaN) in generic code too, while compareTo is total.
Error
pub interface Error {
fn message(self) -> String
}
Anything a function can fail with; ? and fail work on values of this interface.
Fallback
pub interface Fallback[V, R] {
pure noalloc fn branch(move self) -> Branch[V, R]
}
Types usable on the left of ||: Bool, Option and Result.
Methods of i8
i8.toI16
pub pure noalloc fn i8.toI16(self) -> i16
Explicit numeric conversions: no cast syntax, every conversion is a method. A conversion that always fits returns the target type; one that can lose the value returns an Option. usize / isize count as 64 bit here.
i8.toI32
pub pure noalloc fn i8.toI32(self) -> i32
i8.toInt
pub pure noalloc fn i8.toInt(self) -> i64
i8.toIsize
pub pure noalloc fn i8.toIsize(self) -> isize
i8.toU8
pub pure noalloc fn i8.toU8(self) -> u8?
i8.toU16
pub pure noalloc fn i8.toU16(self) -> u16?
i8.toU32
pub pure noalloc fn i8.toU32(self) -> u32?
i8.toU64
pub pure noalloc fn i8.toU64(self) -> u64?
i8.toUsize
pub pure noalloc fn i8.toUsize(self) -> usize?
i8.toFloat
pub pure noalloc fn i8.toFloat(self) -> Float
i8.toF32
pub pure noalloc fn i8.toF32(self) -> f32
i8.toI128
pub pure noalloc fn i8.toI128(self) -> i128
i8.toU128
pub pure noalloc fn i8.toU128(self) -> u128?
i8.truncate
pub pure noalloc fn i8.truncate[T](self) -> T
The low bits of the value as the integer type T, which is no wider than the receiver: value.truncate[u8](). Never fails and reinterprets the sign; toU8() and its siblings return None when the value does not fit.
i8.zero
pub pure fn i8.zero() -> i8
i8.addWithOverflow
pub pure fn i8.addWithOverflow(self, other: i8) -> Overflow[i8]
Sum and whether it overflowed i8's range.
i8.subWithOverflow
pub pure fn i8.subWithOverflow(self, other: i8) -> Overflow[i8]
Difference and whether it overflowed i8's range.
i8.mulWithOverflow
pub pure fn i8.mulWithOverflow(self, other: i8) -> Overflow[i8]
Product and whether it overflowed i8's range.
i8.saturatingAdd
pub pure fn i8.saturatingAdd(self, other: i8) -> i8
Sum clamped to i8's range instead of overflowing.
i8.saturatingSub
pub pure fn i8.saturatingSub(self, other: i8) -> i8
Difference clamped to i8's range instead of overflowing.
i8.saturatingMul
pub pure fn i8.saturatingMul(self, other: i8) -> i8
Product clamped to i8's range instead of overflowing.
i8.wrappingAdd
pub pure noalloc fn i8.wrappingAdd(self, other: i8) -> i8
Sum modulo 2^bits; + panics on overflow instead.
i8.wrappingSub
pub pure noalloc fn i8.wrappingSub(self, other: i8) -> i8
Difference modulo 2^bits.
i8.wrappingMul
pub pure noalloc fn i8.wrappingMul(self, other: i8) -> i8
Product modulo 2^bits.
i8.wrappingShiftLeft
pub pure noalloc fn i8.wrappingShiftLeft(self, count: i8) -> i8
Left shift by count masked to the width.
i8.wrappingShiftRight
pub pure noalloc fn i8.wrappingShiftRight(self, count: i8) -> i8
Right shift by count masked to the width; arithmetic for signed types.
i8.rotateLeft
pub pure noalloc fn i8.rotateLeft(self, count: i8) -> i8
Bits rotated left by count masked to the width.
i8.rotateRight
pub pure noalloc fn i8.rotateRight(self, count: i8) -> i8
Bits rotated right by count masked to the width.
i8.equals
pub pure noalloc fn i8.equals(self, other: &i8) -> Bool
i8.hash
pub pure noalloc fn i8.hash(self) -> u64
i8.compareTo
pub pure noalloc fn i8.compareTo(self, other: &i8) -> Ordering
Methods of i16
i16.toI8
pub pure noalloc fn i16.toI8(self) -> i8?
i16.toI32
pub pure noalloc fn i16.toI32(self) -> i32
i16.toInt
pub pure noalloc fn i16.toInt(self) -> i64
i16.toIsize
pub pure noalloc fn i16.toIsize(self) -> isize
i16.toU8
pub pure noalloc fn i16.toU8(self) -> u8?
i16.toU16
pub pure noalloc fn i16.toU16(self) -> u16?
i16.toU32
pub pure noalloc fn i16.toU32(self) -> u32?
i16.toU64
pub pure noalloc fn i16.toU64(self) -> u64?
i16.toUsize
pub pure noalloc fn i16.toUsize(self) -> usize?
i16.toFloat
pub pure noalloc fn i16.toFloat(self) -> Float
i16.toF32
pub pure noalloc fn i16.toF32(self) -> f32
i16.toI128
pub pure noalloc fn i16.toI128(self) -> i128
i16.toU128
pub pure noalloc fn i16.toU128(self) -> u128?
i16.truncate
pub pure noalloc fn i16.truncate[T](self) -> T
i16.zero
pub pure fn i16.zero() -> i16
i16.addWithOverflow
pub pure fn i16.addWithOverflow(self, other: i16) -> Overflow[i16]
Sum and whether it overflowed i16's range.
i16.subWithOverflow
pub pure fn i16.subWithOverflow(self, other: i16) -> Overflow[i16]
Difference and whether it overflowed i16's range.
i16.mulWithOverflow
pub pure fn i16.mulWithOverflow(self, other: i16) -> Overflow[i16]
Product and whether it overflowed i16's range.
i16.saturatingAdd
pub pure fn i16.saturatingAdd(self, other: i16) -> i16
Sum clamped to i16's range instead of overflowing.
i16.saturatingSub
pub pure fn i16.saturatingSub(self, other: i16) -> i16
Difference clamped to i16's range instead of overflowing.
i16.saturatingMul
pub pure fn i16.saturatingMul(self, other: i16) -> i16
Product clamped to i16's range instead of overflowing.
i16.wrappingAdd
pub pure noalloc fn i16.wrappingAdd(self, other: i16) -> i16
Sum modulo 2^bits; + panics on overflow instead.
i16.wrappingSub
pub pure noalloc fn i16.wrappingSub(self, other: i16) -> i16
Difference modulo 2^bits.
i16.wrappingMul
pub pure noalloc fn i16.wrappingMul(self, other: i16) -> i16
Product modulo 2^bits.
i16.wrappingShiftLeft
pub pure noalloc fn i16.wrappingShiftLeft(self, count: i16) -> i16
Left shift by count masked to the width.
i16.wrappingShiftRight
pub pure noalloc fn i16.wrappingShiftRight(self, count: i16) -> i16
Right shift by count masked to the width; arithmetic for signed types.
i16.rotateLeft
pub pure noalloc fn i16.rotateLeft(self, count: i16) -> i16
Bits rotated left by count masked to the width.
i16.rotateRight
pub pure noalloc fn i16.rotateRight(self, count: i16) -> i16
Bits rotated right by count masked to the width.
i16.equals
pub pure noalloc fn i16.equals(self, other: &i16) -> Bool
i16.hash
pub pure noalloc fn i16.hash(self) -> u64
i16.compareTo
pub pure noalloc fn i16.compareTo(self, other: &i16) -> Ordering
Methods of i32
i32.toI8
pub pure noalloc fn i32.toI8(self) -> i8?
i32.toI16
pub pure noalloc fn i32.toI16(self) -> i16?
i32.toInt
pub pure noalloc fn i32.toInt(self) -> i64
i32.toIsize
pub pure noalloc fn i32.toIsize(self) -> isize
i32.toU8
pub pure noalloc fn i32.toU8(self) -> u8?
i32.toU16
pub pure noalloc fn i32.toU16(self) -> u16?
i32.toU32
pub pure noalloc fn i32.toU32(self) -> u32?
i32.toU64
pub pure noalloc fn i32.toU64(self) -> u64?
i32.toUsize
pub pure noalloc fn i32.toUsize(self) -> usize?
i32.toFloat
pub pure noalloc fn i32.toFloat(self) -> Float
i32.toF32
pub pure noalloc fn i32.toF32(self) -> f32
i32.toI128
pub pure noalloc fn i32.toI128(self) -> i128
i32.toU128
pub pure noalloc fn i32.toU128(self) -> u128?
i32.truncate
pub pure noalloc fn i32.truncate[T](self) -> T
i32.zero
pub pure fn i32.zero() -> i32
i32.addWithOverflow
pub pure fn i32.addWithOverflow(self, other: i32) -> Overflow[i32]
Sum and whether it overflowed i32's range.
i32.subWithOverflow
pub pure fn i32.subWithOverflow(self, other: i32) -> Overflow[i32]
Difference and whether it overflowed i32's range.
i32.mulWithOverflow
pub pure fn i32.mulWithOverflow(self, other: i32) -> Overflow[i32]
Product and whether it overflowed i32's range.
i32.saturatingAdd
pub pure fn i32.saturatingAdd(self, other: i32) -> i32
Sum clamped to i32's range instead of overflowing.
i32.saturatingSub
pub pure fn i32.saturatingSub(self, other: i32) -> i32
Difference clamped to i32's range instead of overflowing.
i32.saturatingMul
pub pure fn i32.saturatingMul(self, other: i32) -> i32
Product clamped to i32's range instead of overflowing.
i32.wrappingAdd
pub pure noalloc fn i32.wrappingAdd(self, other: i32) -> i32
Sum modulo 2^bits; + panics on overflow instead.
i32.wrappingSub
pub pure noalloc fn i32.wrappingSub(self, other: i32) -> i32
Difference modulo 2^bits.
i32.wrappingMul
pub pure noalloc fn i32.wrappingMul(self, other: i32) -> i32
Product modulo 2^bits.
i32.wrappingShiftLeft
pub pure noalloc fn i32.wrappingShiftLeft(self, count: i32) -> i32
Left shift by count masked to the width.
i32.wrappingShiftRight
pub pure noalloc fn i32.wrappingShiftRight(self, count: i32) -> i32
Right shift by count masked to the width; arithmetic for signed types.
i32.rotateLeft
pub pure noalloc fn i32.rotateLeft(self, count: i32) -> i32
Bits rotated left by count masked to the width.
i32.rotateRight
pub pure noalloc fn i32.rotateRight(self, count: i32) -> i32
Bits rotated right by count masked to the width.
i32.equals
pub pure noalloc fn i32.equals(self, other: &i32) -> Bool
Equality; satisfies Eq.
i32.hash
pub pure noalloc fn i32.hash(self) -> u64
Hash of the value; satisfies Hash.
i32.compareTo
pub pure noalloc fn i32.compareTo(self, other: &i32) -> Ordering
Numeric three-way comparison.
Methods of i64
i64.toI8
pub pure noalloc fn i64.toI8(self) -> i8?
i64.toI16
pub pure noalloc fn i64.toI16(self) -> i16?
i64.toI32
pub pure noalloc fn i64.toI32(self) -> i32?
i64.toIsize
pub pure noalloc fn i64.toIsize(self) -> isize
i64.toU8
pub pure noalloc fn i64.toU8(self) -> u8?
i64.toU16
pub pure noalloc fn i64.toU16(self) -> u16?
i64.toU32
pub pure noalloc fn i64.toU32(self) -> u32?
i64.toU64
pub pure noalloc fn i64.toU64(self) -> u64?
i64.toUsize
pub pure noalloc fn i64.toUsize(self) -> usize?
i64.toFloat
pub pure noalloc fn i64.toFloat(self) -> Float
i64.toF32
pub pure noalloc fn i64.toF32(self) -> f32
i64.toI128
pub pure noalloc fn i64.toI128(self) -> i128
i64.toU128
pub pure noalloc fn i64.toU128(self) -> u128?
i64.truncate
pub pure noalloc fn i64.truncate[T](self) -> T
i64.zero
pub pure fn i64.zero() -> i64
i64.addWithOverflow
pub pure fn i64.addWithOverflow(self, other: i64) -> Overflow[i64]
Sum and whether it overflowed i64's range.
i64.subWithOverflow
pub pure fn i64.subWithOverflow(self, other: i64) -> Overflow[i64]
Difference and whether it overflowed i64's range.
i64.mulWithOverflow
pub pure fn i64.mulWithOverflow(self, other: i64) -> Overflow[i64]
Product and whether it overflowed i64's range.
i64.saturatingAdd
pub pure fn i64.saturatingAdd(self, other: i64) -> i64
Sum clamped to i64's range instead of overflowing.
i64.saturatingSub
pub pure fn i64.saturatingSub(self, other: i64) -> i64
Difference clamped to i64's range instead of overflowing.
i64.saturatingMul
pub pure fn i64.saturatingMul(self, other: i64) -> i64
Product clamped to i64's range instead of overflowing.
i64.wrappingAdd
pub pure noalloc fn i64.wrappingAdd(self, other: i64) -> i64
Sum modulo 2^bits; + panics on overflow instead.
i64.wrappingSub
pub pure noalloc fn i64.wrappingSub(self, other: i64) -> i64
Difference modulo 2^bits.
i64.wrappingMul
pub pure noalloc fn i64.wrappingMul(self, other: i64) -> i64
Product modulo 2^bits.
i64.wrappingShiftLeft
pub pure noalloc fn i64.wrappingShiftLeft(self, count: i64) -> i64
Left shift by count masked to the width.
i64.wrappingShiftRight
pub pure noalloc fn i64.wrappingShiftRight(self, count: i64) -> i64
Right shift by count masked to the width; arithmetic for signed types.
i64.rotateLeft
pub pure noalloc fn i64.rotateLeft(self, count: i64) -> i64
Bits rotated left by count masked to the width.
i64.rotateRight
pub pure noalloc fn i64.rotateRight(self, count: i64) -> i64
Bits rotated right by count masked to the width.
i64.equals
pub pure noalloc fn i64.equals(self, other: &i64) -> Bool
Equality; satisfies Eq.
i64.hash
pub pure noalloc fn i64.hash(self) -> u64
Hash of the value; satisfies Hash.
i64.compareTo
pub pure noalloc fn i64.compareTo(self, other: &i64) -> Ordering
Numeric three-way comparison.
Methods of isize
isize.toI8
pub pure noalloc fn isize.toI8(self) -> i8?
isize.toI16
pub pure noalloc fn isize.toI16(self) -> i16?
isize.toI32
pub pure noalloc fn isize.toI32(self) -> i32?
isize.toInt
pub pure noalloc fn isize.toInt(self) -> i64
isize.toU8
pub pure noalloc fn isize.toU8(self) -> u8?
isize.toU16
pub pure noalloc fn isize.toU16(self) -> u16?
isize.toU32
pub pure noalloc fn isize.toU32(self) -> u32?
isize.toU64
pub pure noalloc fn isize.toU64(self) -> u64?
isize.toUsize
pub pure noalloc fn isize.toUsize(self) -> usize?
isize.toFloat
pub pure noalloc fn isize.toFloat(self) -> Float
isize.toF32
pub pure noalloc fn isize.toF32(self) -> f32
isize.toI128
pub pure noalloc fn isize.toI128(self) -> i128
isize.toU128
pub pure noalloc fn isize.toU128(self) -> u128?
isize.truncate
pub pure noalloc fn isize.truncate[T](self) -> T
isize.zero
pub pure fn isize.zero() -> isize
isize.addWithOverflow
pub pure fn isize.addWithOverflow(self, other: isize) -> Overflow[isize]
Sum and whether it overflowed isize's range.
isize.subWithOverflow
pub pure fn isize.subWithOverflow(self, other: isize) -> Overflow[isize]
Difference and whether it overflowed isize's range.
isize.mulWithOverflow
pub pure fn isize.mulWithOverflow(self, other: isize) -> Overflow[isize]
Product and whether it overflowed isize's range.
isize.saturatingAdd
pub pure fn isize.saturatingAdd(self, other: isize) -> isize
Sum clamped to isize's range instead of overflowing.
isize.saturatingSub
pub pure fn isize.saturatingSub(self, other: isize) -> isize
Difference clamped to isize's range instead of overflowing.
isize.saturatingMul
pub pure fn isize.saturatingMul(self, other: isize) -> isize
Product clamped to isize's range instead of overflowing.
isize.wrappingAdd
pub pure noalloc fn isize.wrappingAdd(self, other: isize) -> isize
Sum modulo 2^bits; + panics on overflow instead.
isize.wrappingSub
pub pure noalloc fn isize.wrappingSub(self, other: isize) -> isize
Difference modulo 2^bits.
isize.wrappingMul
pub pure noalloc fn isize.wrappingMul(self, other: isize) -> isize
Product modulo 2^bits.
isize.wrappingShiftLeft
pub pure noalloc fn isize.wrappingShiftLeft(self, count: isize) -> isize
Left shift by count masked to the width.
isize.wrappingShiftRight
pub pure noalloc fn isize.wrappingShiftRight(self, count: isize) -> isize
Right shift by count masked to the width; arithmetic for signed types.
isize.rotateLeft
pub pure noalloc fn isize.rotateLeft(self, count: isize) -> isize
Bits rotated left by count masked to the width.
isize.rotateRight
pub pure noalloc fn isize.rotateRight(self, count: isize) -> isize
Bits rotated right by count masked to the width.
isize.equals
pub pure noalloc fn isize.equals(self, other: &isize) -> Bool
isize.hash
pub pure noalloc fn isize.hash(self) -> u64
isize.compareTo
pub pure noalloc fn isize.compareTo(self, other: &isize) -> Ordering
Methods of u8
u8.toI8
pub pure noalloc fn u8.toI8(self) -> i8?
u8.toI16
pub pure noalloc fn u8.toI16(self) -> i16
u8.toI32
pub pure noalloc fn u8.toI32(self) -> i32
u8.toInt
pub pure noalloc fn u8.toInt(self) -> i64
u8.toIsize
pub pure noalloc fn u8.toIsize(self) -> isize
u8.toU16
pub pure noalloc fn u8.toU16(self) -> u16
u8.toU32
pub pure noalloc fn u8.toU32(self) -> u32
u8.toU64
pub pure noalloc fn u8.toU64(self) -> u64
u8.toUsize
pub pure noalloc fn u8.toUsize(self) -> usize
u8.toFloat
pub pure noalloc fn u8.toFloat(self) -> Float
u8.toF32
pub pure noalloc fn u8.toF32(self) -> f32
u8.toChar
pub pure noalloc fn u8.toChar(self) -> Char
u8.toI128
pub pure noalloc fn u8.toI128(self) -> i128
u8.toU128
pub pure noalloc fn u8.toU128(self) -> u128
u8.truncate
pub pure noalloc fn u8.truncate[T](self) -> T
u8.zero
pub pure fn u8.zero() -> u8
u8.addWithOverflow
pub pure fn u8.addWithOverflow(self, other: u8) -> Overflow[u8]
Sum and whether it overflowed u8's range.
u8.subWithOverflow
pub pure fn u8.subWithOverflow(self, other: u8) -> Overflow[u8]
Difference and whether it overflowed u8's range.
u8.mulWithOverflow
pub pure fn u8.mulWithOverflow(self, other: u8) -> Overflow[u8]
Product and whether it overflowed u8's range.
u8.saturatingAdd
pub pure fn u8.saturatingAdd(self, other: u8) -> u8
Sum clamped to u8's range instead of overflowing.
u8.saturatingSub
pub pure fn u8.saturatingSub(self, other: u8) -> u8
Difference clamped to zero instead of underflowing.
u8.saturatingMul
pub pure fn u8.saturatingMul(self, other: u8) -> u8
Product clamped to u8's range instead of overflowing.
u8.wrappingAdd
pub pure noalloc fn u8.wrappingAdd(self, other: u8) -> u8
Sum modulo 2^bits; + panics on overflow instead.
u8.wrappingSub
pub pure noalloc fn u8.wrappingSub(self, other: u8) -> u8
Difference modulo 2^bits.
u8.wrappingMul
pub pure noalloc fn u8.wrappingMul(self, other: u8) -> u8
Product modulo 2^bits.
u8.wrappingShiftLeft
pub pure noalloc fn u8.wrappingShiftLeft(self, count: u8) -> u8
Left shift by count masked to the width.
u8.wrappingShiftRight
pub pure noalloc fn u8.wrappingShiftRight(self, count: u8) -> u8
Right shift by count masked to the width; arithmetic for signed types.
u8.rotateLeft
pub pure noalloc fn u8.rotateLeft(self, count: u8) -> u8
Bits rotated left by count masked to the width.
u8.rotateRight
pub pure noalloc fn u8.rotateRight(self, count: u8) -> u8
Bits rotated right by count masked to the width.
u8.equals
pub pure noalloc fn u8.equals(self, other: &u8) -> Bool
Equality; satisfies Eq.
u8.hash
pub pure noalloc fn u8.hash(self) -> u64
Hash of the value; satisfies Hash.
u8.compareTo
pub pure noalloc fn u8.compareTo(self, other: &u8) -> Ordering
Numeric three-way comparison.
Methods of u16
u16.toI8
pub pure noalloc fn u16.toI8(self) -> i8?
u16.toI16
pub pure noalloc fn u16.toI16(self) -> i16?
u16.toI32
pub pure noalloc fn u16.toI32(self) -> i32
u16.toInt
pub pure noalloc fn u16.toInt(self) -> i64
u16.toIsize
pub pure noalloc fn u16.toIsize(self) -> isize
u16.toU8
pub pure noalloc fn u16.toU8(self) -> u8?
u16.toU32
pub pure noalloc fn u16.toU32(self) -> u32
u16.toU64
pub pure noalloc fn u16.toU64(self) -> u64
u16.toUsize
pub pure noalloc fn u16.toUsize(self) -> usize
u16.toFloat
pub pure noalloc fn u16.toFloat(self) -> Float
u16.toF32
pub pure noalloc fn u16.toF32(self) -> f32
u16.toI128
pub pure noalloc fn u16.toI128(self) -> i128
u16.toU128
pub pure noalloc fn u16.toU128(self) -> u128
u16.truncate
pub pure noalloc fn u16.truncate[T](self) -> T
u16.zero
pub pure fn u16.zero() -> u16
u16.addWithOverflow
pub pure fn u16.addWithOverflow(self, other: u16) -> Overflow[u16]
Sum and whether it overflowed u16's range.
u16.subWithOverflow
pub pure fn u16.subWithOverflow(self, other: u16) -> Overflow[u16]
Difference and whether it overflowed u16's range.
u16.mulWithOverflow
pub pure fn u16.mulWithOverflow(self, other: u16) -> Overflow[u16]
Product and whether it overflowed u16's range.
u16.saturatingAdd
pub pure fn u16.saturatingAdd(self, other: u16) -> u16
Sum clamped to u16's range instead of overflowing.
u16.saturatingSub
pub pure fn u16.saturatingSub(self, other: u16) -> u16
Difference clamped to zero instead of underflowing.
u16.saturatingMul
pub pure fn u16.saturatingMul(self, other: u16) -> u16
Product clamped to u16's range instead of overflowing.
u16.wrappingAdd
pub pure noalloc fn u16.wrappingAdd(self, other: u16) -> u16
Sum modulo 2^bits; + panics on overflow instead.
u16.wrappingSub
pub pure noalloc fn u16.wrappingSub(self, other: u16) -> u16
Difference modulo 2^bits.
u16.wrappingMul
pub pure noalloc fn u16.wrappingMul(self, other: u16) -> u16
Product modulo 2^bits.
u16.wrappingShiftLeft
pub pure noalloc fn u16.wrappingShiftLeft(self, count: u16) -> u16
Left shift by count masked to the width.
u16.wrappingShiftRight
pub pure noalloc fn u16.wrappingShiftRight(self, count: u16) -> u16
Right shift by count masked to the width; arithmetic for signed types.
u16.rotateLeft
pub pure noalloc fn u16.rotateLeft(self, count: u16) -> u16
Bits rotated left by count masked to the width.
u16.rotateRight
pub pure noalloc fn u16.rotateRight(self, count: u16) -> u16
Bits rotated right by count masked to the width.
u16.equals
pub pure noalloc fn u16.equals(self, other: &u16) -> Bool
u16.hash
pub pure noalloc fn u16.hash(self) -> u64
u16.compareTo
pub pure noalloc fn u16.compareTo(self, other: &u16) -> Ordering
Methods of u32
u32.toI8
pub pure noalloc fn u32.toI8(self) -> i8?
u32.toI16
pub pure noalloc fn u32.toI16(self) -> i16?
u32.toI32
pub pure noalloc fn u32.toI32(self) -> i32?
u32.toInt
pub pure noalloc fn u32.toInt(self) -> i64
u32.toIsize
pub pure noalloc fn u32.toIsize(self) -> isize
u32.toU8
pub pure noalloc fn u32.toU8(self) -> u8?
u32.toU16
pub pure noalloc fn u32.toU16(self) -> u16?
u32.toU64
pub pure noalloc fn u32.toU64(self) -> u64
u32.toUsize
pub pure noalloc fn u32.toUsize(self) -> usize
u32.toFloat
pub pure noalloc fn u32.toFloat(self) -> Float
u32.toF32
pub pure noalloc fn u32.toF32(self) -> f32
u32.toI128
pub pure noalloc fn u32.toI128(self) -> i128
u32.toU128
pub pure noalloc fn u32.toU128(self) -> u128
u32.truncate
pub pure noalloc fn u32.truncate[T](self) -> T
u32.zero
pub pure fn u32.zero() -> u32
u32.addWithOverflow
pub pure fn u32.addWithOverflow(self, other: u32) -> Overflow[u32]
Sum and whether it overflowed u32's range.
u32.subWithOverflow
pub pure fn u32.subWithOverflow(self, other: u32) -> Overflow[u32]
Difference and whether it overflowed u32's range.
u32.mulWithOverflow
pub pure fn u32.mulWithOverflow(self, other: u32) -> Overflow[u32]
Product and whether it overflowed u32's range.
u32.saturatingAdd
pub pure fn u32.saturatingAdd(self, other: u32) -> u32
Sum clamped to u32's range instead of overflowing.
u32.saturatingSub
pub pure fn u32.saturatingSub(self, other: u32) -> u32
Difference clamped to zero instead of underflowing.
u32.saturatingMul
pub pure fn u32.saturatingMul(self, other: u32) -> u32
Product clamped to u32's range instead of overflowing.
u32.wrappingAdd
pub pure noalloc fn u32.wrappingAdd(self, other: u32) -> u32
Sum modulo 2^bits; + panics on overflow instead.
u32.wrappingSub
pub pure noalloc fn u32.wrappingSub(self, other: u32) -> u32
Difference modulo 2^bits.
u32.wrappingMul
pub pure noalloc fn u32.wrappingMul(self, other: u32) -> u32
Product modulo 2^bits.
u32.wrappingShiftLeft
pub pure noalloc fn u32.wrappingShiftLeft(self, count: u32) -> u32
Left shift by count masked to the width.
u32.wrappingShiftRight
pub pure noalloc fn u32.wrappingShiftRight(self, count: u32) -> u32
Right shift by count masked to the width; arithmetic for signed types.
u32.rotateLeft
pub pure noalloc fn u32.rotateLeft(self, count: u32) -> u32
Bits rotated left by count masked to the width.
u32.rotateRight
pub pure noalloc fn u32.rotateRight(self, count: u32) -> u32
Bits rotated right by count masked to the width.
u32.equals
pub pure noalloc fn u32.equals(self, other: &u32) -> Bool
u32.hash
pub pure noalloc fn u32.hash(self) -> u64
u32.compareTo
pub pure noalloc fn u32.compareTo(self, other: &u32) -> Ordering
Methods of u64
u64.toI8
pub pure noalloc fn u64.toI8(self) -> i8?
u64.toI16
pub pure noalloc fn u64.toI16(self) -> i16?
u64.toI32
pub pure noalloc fn u64.toI32(self) -> i32?
u64.toInt
pub pure noalloc fn u64.toInt(self) -> i64?
u64.toIsize
pub pure noalloc fn u64.toIsize(self) -> isize?
u64.toU8
pub pure noalloc fn u64.toU8(self) -> u8?
u64.toU16
pub pure noalloc fn u64.toU16(self) -> u16?
u64.toU32
pub pure noalloc fn u64.toU32(self) -> u32?
u64.toUsize
pub pure noalloc fn u64.toUsize(self) -> usize
u64.toFloat
pub pure noalloc fn u64.toFloat(self) -> Float
u64.toF32
pub pure noalloc fn u64.toF32(self) -> f32
u64.toI128
pub pure noalloc fn u64.toI128(self) -> i128
u64.toU128
pub pure noalloc fn u64.toU128(self) -> u128
u64.truncate
pub pure noalloc fn u64.truncate[T](self) -> T
u64.zero
pub pure fn u64.zero() -> u64
u64.addWithOverflow
pub pure fn u64.addWithOverflow(self, other: u64) -> Overflow[u64]
Sum and whether it overflowed u64's range.
u64.subWithOverflow
pub pure fn u64.subWithOverflow(self, other: u64) -> Overflow[u64]
Difference and whether it overflowed u64's range.
u64.mulWithOverflow
pub pure fn u64.mulWithOverflow(self, other: u64) -> Overflow[u64]
Product and whether it overflowed u64's range.
u64.saturatingAdd
pub pure fn u64.saturatingAdd(self, other: u64) -> u64
Sum clamped to u64's range instead of overflowing.
u64.saturatingSub
pub pure fn u64.saturatingSub(self, other: u64) -> u64
Difference clamped to zero instead of underflowing.
u64.saturatingMul
pub pure fn u64.saturatingMul(self, other: u64) -> u64
Product clamped to u64's range instead of overflowing.
u64.wrappingAdd
pub pure noalloc fn u64.wrappingAdd(self, other: u64) -> u64
Sum modulo 2^bits; + panics on overflow instead.
u64.wrappingSub
pub pure noalloc fn u64.wrappingSub(self, other: u64) -> u64
Difference modulo 2^bits.
u64.wrappingMul
pub pure noalloc fn u64.wrappingMul(self, other: u64) -> u64
Product modulo 2^bits.
u64.wrappingShiftLeft
pub pure noalloc fn u64.wrappingShiftLeft(self, count: u64) -> u64
Left shift by count masked to the width.
u64.wrappingShiftRight
pub pure noalloc fn u64.wrappingShiftRight(self, count: u64) -> u64
Right shift by count masked to the width; arithmetic for signed types.
u64.rotateLeft
pub pure noalloc fn u64.rotateLeft(self, count: u64) -> u64
Bits rotated left by count masked to the width.
u64.rotateRight
pub pure noalloc fn u64.rotateRight(self, count: u64) -> u64
Bits rotated right by count masked to the width.
u64.equals
pub pure noalloc fn u64.equals(self, other: &u64) -> Bool
u64.hash
pub pure noalloc fn u64.hash(self) -> u64
u64.compareTo
pub pure noalloc fn u64.compareTo(self, other: &u64) -> Ordering
Methods of usize
usize.toI8
pub pure noalloc fn usize.toI8(self) -> i8?
usize.toI16
pub pure noalloc fn usize.toI16(self) -> i16?
usize.toI32
pub pure noalloc fn usize.toI32(self) -> i32?
usize.toInt
pub pure noalloc fn usize.toInt(self) -> i64?
usize.toIsize
pub pure noalloc fn usize.toIsize(self) -> isize?
usize.toU8
pub pure noalloc fn usize.toU8(self) -> u8?
usize.toU16
pub pure noalloc fn usize.toU16(self) -> u16?
usize.toU32
pub pure noalloc fn usize.toU32(self) -> u32?
usize.toU64
pub pure noalloc fn usize.toU64(self) -> u64
usize.toFloat
pub pure noalloc fn usize.toFloat(self) -> Float
usize.toF32
pub pure noalloc fn usize.toF32(self) -> f32
usize.toI128
pub pure noalloc fn usize.toI128(self) -> i128
usize.toU128
pub pure noalloc fn usize.toU128(self) -> u128
usize.truncate
pub pure noalloc fn usize.truncate[T](self) -> T
usize.zero
pub pure fn usize.zero() -> usize
usize.addWithOverflow
pub pure fn usize.addWithOverflow(self, other: usize) -> Overflow[usize]
Sum and whether it overflowed usize's range.
usize.subWithOverflow
pub pure fn usize.subWithOverflow(self, other: usize) -> Overflow[usize]
Difference and whether it overflowed usize's range.
usize.mulWithOverflow
pub pure fn usize.mulWithOverflow(self, other: usize) -> Overflow[usize]
Product and whether it overflowed usize's range.
usize.saturatingAdd
pub pure fn usize.saturatingAdd(self, other: usize) -> usize
Sum clamped to usize's range instead of overflowing.
usize.saturatingSub
pub pure fn usize.saturatingSub(self, other: usize) -> usize
Difference clamped to zero instead of underflowing.
usize.saturatingMul
pub pure fn usize.saturatingMul(self, other: usize) -> usize
Product clamped to usize's range instead of overflowing.
usize.wrappingAdd
pub pure noalloc fn usize.wrappingAdd(self, other: usize) -> usize
Sum modulo 2^bits; + panics on overflow instead.
usize.wrappingSub
pub pure noalloc fn usize.wrappingSub(self, other: usize) -> usize
Difference modulo 2^bits.
usize.wrappingMul
pub pure noalloc fn usize.wrappingMul(self, other: usize) -> usize
Product modulo 2^bits.
usize.wrappingShiftLeft
pub pure noalloc fn usize.wrappingShiftLeft(self, count: usize) -> usize
Left shift by count masked to the width.
usize.wrappingShiftRight
pub pure noalloc fn usize.wrappingShiftRight(self, count: usize) -> usize
Right shift by count masked to the width; arithmetic for signed types.
usize.rotateLeft
pub pure noalloc fn usize.rotateLeft(self, count: usize) -> usize
Bits rotated left by count masked to the width.
usize.rotateRight
pub pure noalloc fn usize.rotateRight(self, count: usize) -> usize
Bits rotated right by count masked to the width.
usize.equals
pub pure noalloc fn usize.equals(self, other: &usize) -> Bool
Equality; satisfies Eq.
usize.hash
pub pure noalloc fn usize.hash(self) -> u64
Hash of the value; satisfies Hash.
usize.compareTo
pub pure noalloc fn usize.compareTo(self, other: &usize) -> Ordering
Numeric three-way comparison.
Methods of f64
f64.toInt
pub pure noalloc fn f64.toInt(self) -> Int?
Truncates toward zero; None for NaN, an infinity or a value outside the Int range.
f64.toF32
pub pure noalloc fn f64.toF32(self) -> f32
f64.toI128
pub pure noalloc fn f64.toI128(self) -> i128?
f64.toU128
pub pure noalloc fn f64.toU128(self) -> u128?
f64.zero
pub pure fn f64.zero() -> f64
f64.equals
pub pure noalloc fn f64.equals(self, other: &f64) -> Bool
f64.hash
pub pure noalloc fn f64.hash(self) -> u64
f64.compareTo
pub pure noalloc fn f64.compareTo(self, other: &f64) -> Ordering
Methods of f32
f32.toInt
pub pure noalloc fn f32.toInt(self) -> Int?
f32.toF64
pub pure noalloc fn f32.toF64(self) -> Float
f32.toI128
pub pure noalloc fn f32.toI128(self) -> i128?
f32.toU128
pub pure noalloc fn f32.toU128(self) -> u128?
f32.zero
pub pure fn f32.zero() -> f32
f32.equals
pub pure noalloc fn f32.equals(self, other: &f32) -> Bool
f32.hash
pub pure noalloc fn f32.hash(self) -> u64
f32.compareTo
pub pure noalloc fn f32.compareTo(self, other: &f32) -> Ordering
Methods of Char
Char.toInt
pub pure noalloc fn Char.toInt(self) -> Int
The Unicode scalar value of the character.
Char.fromInt
pub pure noalloc fn Char.fromInt(value: Int) -> Char?
The character with this scalar value; None outside 0..0x10FFFF or inside the surrogate range.
Char.equals
pub pure noalloc fn Char.equals(self, other: &Char) -> Bool
Char.hash
pub pure noalloc fn Char.hash(self) -> u64
Char.compareTo
pub pure noalloc fn Char.compareTo(self, other: &Char) -> Ordering
Methods of i128
i128.toI8
pub pure noalloc fn i128.toI8(self) -> i8?
i128.toI16
pub pure noalloc fn i128.toI16(self) -> i16?
i128.toI32
pub pure noalloc fn i128.toI32(self) -> i32?
i128.toInt
pub pure noalloc fn i128.toInt(self) -> i64?
i128.toIsize
pub pure noalloc fn i128.toIsize(self) -> isize?
i128.toU8
pub pure noalloc fn i128.toU8(self) -> u8?
i128.toU16
pub pure noalloc fn i128.toU16(self) -> u16?
i128.toU32
pub pure noalloc fn i128.toU32(self) -> u32?
i128.toU64
pub pure noalloc fn i128.toU64(self) -> u64?
i128.toUsize
pub pure noalloc fn i128.toUsize(self) -> usize?
i128.toU128
pub pure noalloc fn i128.toU128(self) -> u128?
i128.toFloat
pub pure noalloc fn i128.toFloat(self) -> Float
i128.toF32
pub pure noalloc fn i128.toF32(self) -> f32
i128.truncate
pub pure noalloc fn i128.truncate[T](self) -> T
i128.zero
pub pure fn i128.zero() -> i128
i128.addWithOverflow
pub pure fn i128.addWithOverflow(self, other: i128) -> Overflow[i128]
Sum and whether it overflowed i128's range.
i128.subWithOverflow
pub pure fn i128.subWithOverflow(self, other: i128) -> Overflow[i128]
Difference and whether it overflowed i128's range.
i128.mulWithOverflow
pub pure fn i128.mulWithOverflow(self, other: i128) -> Overflow[i128]
Product and whether it overflowed i128's range.
i128.saturatingAdd
pub pure fn i128.saturatingAdd(self, other: i128) -> i128
Sum clamped to i128's range instead of overflowing.
i128.saturatingSub
pub pure fn i128.saturatingSub(self, other: i128) -> i128
Difference clamped to i128's range instead of overflowing.
i128.saturatingMul
pub pure fn i128.saturatingMul(self, other: i128) -> i128
Product clamped to i128's range instead of overflowing.
i128.wrappingAdd
pub pure noalloc fn i128.wrappingAdd(self, other: i128) -> i128
Sum modulo 2^bits; + panics on overflow instead.
i128.wrappingSub
pub pure noalloc fn i128.wrappingSub(self, other: i128) -> i128
Difference modulo 2^bits.
i128.wrappingMul
pub pure noalloc fn i128.wrappingMul(self, other: i128) -> i128
Product modulo 2^bits.
i128.wrappingShiftLeft
pub pure noalloc fn i128.wrappingShiftLeft(self, count: i128) -> i128
Left shift by count masked to the width.
i128.wrappingShiftRight
pub pure noalloc fn i128.wrappingShiftRight(self, count: i128) -> i128
Right shift by count masked to the width; arithmetic for signed types.
i128.rotateLeft
pub pure noalloc fn i128.rotateLeft(self, count: i128) -> i128
Bits rotated left by count masked to the width.
i128.rotateRight
pub pure noalloc fn i128.rotateRight(self, count: i128) -> i128
Bits rotated right by count masked to the width.
i128.equals
pub pure noalloc fn i128.equals(self, other: &i128) -> Bool
i128.hash
pub pure noalloc fn i128.hash(self) -> u64
i128.compareTo
pub pure noalloc fn i128.compareTo(self, other: &i128) -> Ordering
Methods of u128
u128.toI8
pub pure noalloc fn u128.toI8(self) -> i8?
u128.toI16
pub pure noalloc fn u128.toI16(self) -> i16?
u128.toI32
pub pure noalloc fn u128.toI32(self) -> i32?
u128.toInt
pub pure noalloc fn u128.toInt(self) -> i64?
u128.toIsize
pub pure noalloc fn u128.toIsize(self) -> isize?
u128.toU8
pub pure noalloc fn u128.toU8(self) -> u8?
u128.toU16
pub pure noalloc fn u128.toU16(self) -> u16?
u128.toU32
pub pure noalloc fn u128.toU32(self) -> u32?
u128.toU64
pub pure noalloc fn u128.toU64(self) -> u64?
u128.toUsize
pub pure noalloc fn u128.toUsize(self) -> usize?
u128.toI128
pub pure noalloc fn u128.toI128(self) -> i128?
u128.toFloat
pub pure noalloc fn u128.toFloat(self) -> Float
u128.toF32
pub pure noalloc fn u128.toF32(self) -> f32
u128.truncate
pub pure noalloc fn u128.truncate[T](self) -> T
u128.zero
pub pure fn u128.zero() -> u128
u128.addWithOverflow
pub pure fn u128.addWithOverflow(self, other: u128) -> Overflow[u128]
Sum and whether it overflowed u128's range.
u128.subWithOverflow
pub pure fn u128.subWithOverflow(self, other: u128) -> Overflow[u128]
Difference and whether it overflowed u128's range.
u128.mulWithOverflow
pub pure fn u128.mulWithOverflow(self, other: u128) -> Overflow[u128]
Product and whether it overflowed u128's range.
u128.saturatingAdd
pub pure fn u128.saturatingAdd(self, other: u128) -> u128
Sum clamped to u128's range instead of overflowing.
u128.saturatingSub
pub pure fn u128.saturatingSub(self, other: u128) -> u128
Difference clamped to zero instead of underflowing.
u128.saturatingMul
pub pure fn u128.saturatingMul(self, other: u128) -> u128
Product clamped to u128's range instead of overflowing.
u128.wrappingAdd
pub pure noalloc fn u128.wrappingAdd(self, other: u128) -> u128
Sum modulo 2^bits; + panics on overflow instead.
u128.wrappingSub
pub pure noalloc fn u128.wrappingSub(self, other: u128) -> u128
Difference modulo 2^bits.
u128.wrappingMul
pub pure noalloc fn u128.wrappingMul(self, other: u128) -> u128
Product modulo 2^bits.
u128.wrappingShiftLeft
pub pure noalloc fn u128.wrappingShiftLeft(self, count: u128) -> u128
Left shift by count masked to the width.
u128.wrappingShiftRight
pub pure noalloc fn u128.wrappingShiftRight(self, count: u128) -> u128
Right shift by count masked to the width; arithmetic for signed types.
u128.rotateLeft
pub pure noalloc fn u128.rotateLeft(self, count: u128) -> u128
Bits rotated left by count masked to the width.
u128.rotateRight
pub pure noalloc fn u128.rotateRight(self, count: u128) -> u128
Bits rotated right by count masked to the width.
u128.equals
pub pure noalloc fn u128.equals(self, other: &u128) -> Bool
u128.hash
pub pure noalloc fn u128.hash(self) -> u64
u128.compareTo
pub pure noalloc fn u128.compareTo(self, other: &u128) -> Ordering
Methods of Bytes
Bytes.toFixed
pub pure fn Bytes.toFixed[const N: usize](self) -> FixedArray[u8, N]?
N bytes read out of a Bytes value, or None when its length is not N. On Bytes because a receiver binder cannot fix T to u8 on FixedArray.
Bytes.fromArray
pub pure fn Bytes.fromArray(items: &Array[u8]) -> Bytes
Bytes holding the items in order.
Bytes.tryFromArray
pub pure fn Bytes.tryFromArray(items: &Array[u8]) -> Result[Bytes, AllocError]
Bytes holding the items in order, or AllocError when the allocator refuses (fromArray panics instead).
Bytes.len
pub pure noalloc fn Bytes.len(self) -> usize
Number of bytes.
Bytes.get
pub pure noalloc fn Bytes.get(self, index: usize) -> u8?
Byte at index, or None past the end.
Bytes.slice
pub pure fn Bytes.slice(self, start: usize, end: usize) -> Bytes?
Bytes start..end of self; None unless start <= end <= self.len().
Bytes.trySlice
pub pure fn Bytes.trySlice(self, start: usize, end: usize) -> Result[Bytes?, AllocError]
Same as slice, or AllocError when the allocator refuses (slice panics instead).
Bytes.indexOf
pub pure fn Bytes.indexOf(self, sub: Bytes) -> usize?
Byte-wise position of the first occurrence of sub in self; the empty sub matches at 0. Runs in time linear in both lengths.
Bytes.lastIndexOf
pub pure fn Bytes.lastIndexOf(self, sub: Bytes) -> usize?
Byte-wise position of the last occurrence of sub in self; the empty sub matches at self.len(). Runs in time linear in both lengths.
Bytes.matchesAt
pub pure noalloc fn Bytes.matchesAt(self, sub: Bytes, at: usize) -> Bool
Whether the bytes of sub appear at byte offset at; false for any offset past the end.
Bytes.startsWith
pub pure noalloc fn Bytes.startsWith(self, sub: Bytes) -> Bool
Whether self begins with sub.
Bytes.endsWith
pub pure noalloc fn Bytes.endsWith(self, sub: Bytes) -> Bool
Whether self ends with sub.
Bytes.contains
pub pure fn Bytes.contains(self, sub: Bytes) -> Bool
Whether sub occurs in self; the empty sub occurs in every Bytes.
Bytes.zeros
pub pure fn Bytes.zeros(n: usize) -> Bytes
n zero bytes.
Bytes.tryZeros
pub pure fn Bytes.tryZeros(n: usize) -> Result[Bytes, AllocError]
n zero bytes, or AllocError when the allocator refuses (zeros panics instead).
Bytes.fill
pub pure fn Bytes.fill(value: u8, n: usize) -> Bytes
n bytes, each set to value.
Bytes.tryFill
pub pure fn Bytes.tryFill(value: u8, n: usize) -> Result[Bytes, AllocError]
n bytes, each set to value, or AllocError when the allocator refuses (fill panics instead).
Bytes.concat
pub pure fn Bytes.concat(self, other: Bytes) -> Bytes
The bytes of self followed by those of other.
Bytes.tryConcat
pub pure fn Bytes.tryConcat(self, other: Bytes) -> Result[Bytes, AllocError]
self followed by other, or AllocError when the allocator refuses (concat panics instead).
Bytes.equals
pub pure noalloc fn Bytes.equals(self, other: &Bytes) -> Bool
Bytes.hash
pub pure noalloc fn Bytes.hash(self) -> u64
Bytes.compareTo
pub pure noalloc fn Bytes.compareTo(self, other: &Bytes) -> Ordering
Methods of Bool
Bool.branch
pub pure noalloc fn Bool.branch(move self) -> Branch[Bool, Void]
Hit(true) for true, Miss(()) for false.
Bool.equals
pub pure noalloc fn Bool.equals(self, other: &Bool) -> Bool
Bool.hash
pub pure noalloc fn Bool.hash(self) -> u64
Bool.compareTo
pub pure noalloc fn Bool.compareTo(self, other: &Bool) -> Ordering
Methods of Option
Option.branch
pub pure noalloc fn Option[T].branch(move self) -> Branch[T, Void]
Hit(value) for Some, Miss(()) for None.
Option.unwrap
pub pure fn Option[T].unwrap(move self) -> T
The value of Some; panics on None.
Option.expect
pub pure fn Option[T].expect(move self, message: String) -> T
The value of Some; panics with message on None.
Option.with
pub pure fn Option[T].with[R, F: FnOnce[fn(&T) -> R]](self, f: F) -> R?
Calls f with a borrow of the value; None when there is none.
Option.map
pub pure fn Option[T].map[U, F: FnOnce[fn(T) -> U]](move self, f: F) -> U?
Transforms the value of Some by consuming it; None stays None.
Option.andThen
pub pure fn Option[T].andThen[U, F: FnOnce[fn(T) -> U?]](move self, f: F) -> U?
Chains an Option-returning step onto the value of Some, consuming it; None stays None.
Option.unwrapOr
pub pure fn Option[T].unwrapOr(move self, fallback: T) -> T
The value of Some, or fallback for None.
Option.unwrapOrElse
pub pure fn Option[T].unwrapOrElse[F: FnOnce[fn() -> T]](move self, f: F) -> T
The value of Some, or what f builds for None.
Option.orElse
pub pure fn Option[T].orElse[F: FnOnce[fn() -> T?]](move self, f: F) -> T?
Some stays as it is; for None, what f builds.
Option.filter
pub pure fn Option[T].filter[F: FnOnce[fn(&T) -> Bool]](move self, keep: F) -> T?
Keeps the value of Some only when keep accepts a borrow of it; otherwise None.
Option.take
pub pure fn Option[T].take(mut self) -> T?
Moves the value out, leaving None in its place.
Methods of Result
Result.branch
pub pure noalloc fn Result[T, E].branch(move self) -> Branch[T, E]
Hit(value) for Ok, Miss(error) for Err.
Result.unwrap
pub pure fn Result[T, E].unwrap(move self) -> T
The value of Ok; panics on Err.
Result.expect
pub pure fn Result[T, E].expect(move self, message: String) -> T
The value of Ok; panics with message on Err.
Result.map
pub pure fn Result[T, E].map[U, F: FnOnce[fn(T) -> U]](move self, f: F) -> Result[U, E]
Transforms the value of Ok by consuming it; Err stays Err.
Result.mapErr
pub pure fn Result[T, E].mapErr[X, F: FnOnce[fn(E) -> X]](move self, f: F) -> Result[T, X]
Transforms the error of Err by consuming it; Ok stays Ok.
Result.andThen
pub pure fn Result[T, E].andThen[U, F: FnOnce[fn(T) -> Result[U, E]]](move self, f: F) -> Result[U, E]
Chains a Result-returning step onto the value of Ok, consuming it; Err stays Err.
Result.unwrapOrElse
pub pure fn Result[T, E].unwrapOrElse[F: FnOnce[fn(E) -> T]](move self, f: F) -> T
The value of Ok, or what f builds from the error of Err.
Result.orElse
pub pure fn Result[T, E].orElse[X, F: FnOnce[fn(E) -> Result[T, X]]](move self, f: F) -> Result[T, X]
Ok stays as it is; for Err, what f builds from the error.
Methods of String
String.len
pub pure noalloc fn String.len(self) -> usize
Length in bytes.
String.isEmpty
pub pure noalloc fn String.isEmpty(self) -> Bool
Whether the string has no bytes.
String.bytes
pub pure noalloc fn String.bytes(self) -> Bytes
The UTF-8 bytes of the string.
String.chars
pub pure fn String.chars(self) -> Array[Char]
The Unicode scalar values of the string, in order.
String.tryChars
pub pure fn String.tryChars(self) -> Result[Array[Char], AllocError]
Same as chars, or AllocError when the allocator refuses (chars panics instead).
String.contains
pub pure noalloc fn String.contains(self, sub: String) -> Bool
Whether sub occurs in the string; the empty string occurs in every string. Runs in time linear in both lengths.
String.matchesAt
pub pure noalloc fn String.matchesAt(self, sub: String, at: usize) -> Bool
Whether the bytes of sub appear at byte offset at; false for any offset past the end.
String.startsWith
pub pure noalloc fn String.startsWith(self, prefix: String) -> Bool
Whether the string begins with prefix.
String.endsWith
pub pure noalloc fn String.endsWith(self, suffix: String) -> Bool
Whether the string ends with suffix.
String.sliceBytes
pub pure fn String.sliceBytes(self, start: usize, end: usize) -> String?
Bytes start..end of the string; None unless both offsets are within it and on character boundaries.
String.trySliceBytes
pub pure fn String.trySliceBytes(self, start: usize, end: usize) -> Result[String?, AllocError]
Same as sliceBytes, or AllocError when the allocator refuses (sliceBytes panics instead).
String.trim
pub pure fn String.trim(self) -> String
Copy without leading and trailing ASCII whitespace (space, tab, CR, LF).
String.tryTrim
pub pure fn String.tryTrim(self) -> Result[String, AllocError]
Copy without leading and trailing ASCII whitespace, or AllocError when the allocator refuses (trim panics instead).
String.split
pub pure fn String.split(self, sep: String) -> Array[String]
Pieces between occurrences of sep, empty pieces included; an empty sep yields the whole string as one piece.
String.trySplit
pub pure fn String.trySplit(self, sep: String) -> Result[Array[String], AllocError]
Same as split, or AllocError when the allocator refuses (split panics instead).
String.concat
pub pure fn String.concat(self, other: String) -> String
self followed by other.
String.tryConcat
pub pure fn String.tryConcat(self, other: String) -> Result[String, AllocError]
self followed by other, or AllocError when the allocator refuses (concat panics instead).
String.toUpper
pub pure fn String.toUpper(self) -> String
Copy with ASCII letters upper-cased; other bytes are kept.
String.tryToUpper
pub pure fn String.tryToUpper(self) -> Result[String, AllocError]
Same as toUpper, or AllocError when the allocator refuses (toUpper panics instead).
String.toLower
pub pure fn String.toLower(self) -> String
Copy with ASCII letters lower-cased; other bytes are kept.
String.tryToLower
pub pure fn String.tryToLower(self) -> Result[String, AllocError]
Same as toLower, or AllocError when the allocator refuses (toLower panics instead).
String.repeat
pub pure fn String.repeat(self, count: usize) -> String
The string repeated count times.
String.tryRepeat
pub pure fn String.tryRepeat(self, count: usize) -> Result[String, AllocError]
The string repeated count times, or AllocError when the allocator refuses (repeat panics instead).
String.toBytes
pub pure noalloc fn String.toBytes(self) -> Bytes
The UTF-8 bytes of the string.
String.fromBytes
pub pure fn String.fromBytes(bytes: Bytes) -> String!
Interprets bytes as UTF-8; fails when they are not valid UTF-8.
String.tryFromBytes
pub pure fn String.tryFromBytes(bytes: Bytes) -> String!
Interprets bytes as UTF-8, same as fromBytes, but reports an allocator refusal as an error too instead of risking the crash fromBytes has there.
String.equals
pub pure noalloc fn String.equals(self, other: &String) -> Bool
Byte-wise equality; satisfies Eq.
String.hash
pub pure noalloc fn String.hash(self) -> u64
Hash of the bytes; satisfies Hash.
String.compareTo
pub pure noalloc fn String.compareTo(self, other: &String) -> Ordering
Byte-wise lexicographic comparison.
Methods of Void
Void.equals
pub pure noalloc fn Void.equals(self, other: &Void) -> Bool
Void.hash
pub pure noalloc fn Void.hash(self) -> u64
Void.compareTo
pub pure noalloc fn Void.compareTo(self, other: &Void) -> Ordering
Functions
debug
pub pure fn debug[T](value: &T) -> String
A readable rendering of any value, for diagnostics; not a stable format.
tryDebug
pub pure fn tryDebug[T](value: &T) -> Result[String, AllocError]
Same as debug, or AllocError when the allocator refuses (debug panics instead).
hash
pub pure fn hash[T: Hash](value: &T) -> u64
The hash of any Hash value; lets generic code hash a T: Hash.