API reference Dodo 0.1.4

std/collections

Public declarations, types, methods, and source contracts for std/collections.

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 "std/collections"

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 collections.dodo
ptr core/ptr collections.dodo

I32

Struct · Source

Policies use statically resolved methods, without traits or function objects. compare(&T,&T) returns negative/zero/positive; equal(&T,&T) returns bool.

pub struct I32 {

}

I32.compare

Function · Source

pub fn compare(&self, a: &i32, b: &i32) -> i32

I32.equal

Function · Source

pub fn equal(&self, a: &i32, b: &i32) -> bool

U64

Struct · Source

pub struct U64 {

}

U64.compare

Function · Source

pub fn compare(&self, a: &u64, b: &u64) -> i32

U64.equal

Function · Source

pub fn equal(&self, a: &u64, b: &u64) -> bool

CapacityError

Enum · Source

pub enum CapacityError {
    Full, OutOfBounds
}

swap

Function · Source

Checked indices, ownership-moving exchange, no destruction. O(1). The mem.init gate explicitly rejects borrow/Result-bearing element types.

pub fn swap<T>(data: &mut[T], a: usize, b: usize) -> bool

find

Function · Source

pub fn find<T, E>(data: &[T], needle: &T, equality: &E) -> Option<usize>

equal

Function · Source

pub fn equal<T, E>(a: &[T], b: &[T], equality: &E) -> bool

compare

Function · Source

pub fn compare<T, C>(a: &[T], b: &[T], ordering: &C) -> i32

lower_bound

Function · Source

First element >= needle; insertion position on an empty slice is zero.

pub fn lower_bound<T, C>(data: &[T], needle: &T, ordering: &C) -> usize

upper_bound

Function · Source

pub fn upper_bound<T, C>(data: &[T], needle: &T, ordering: &C) -> usize

Function · Source

pub fn binary_search<T, C>(data: &[T], needle: &T, ordering: &C) -> Option<usize>

is_sorted

Function · Source

pub fn is_sorted<T, C>(data: &[T], ordering: &C) -> bool

sort

Function · Source

In-place heapsort: O(n log n) worst case, O(1) storage, unstable.

pub fn sort<T, C>(data: &mut[T], ordering: &C)

stable_sort

Function · Source

Stable insertion sort: O(n²) worst case; O(n) for sorted input.

pub fn stable_sort<T, C>(data: &mut[T], ordering: &C)

partition

Function · Source

Predicate provides test(&T)->bool. True values precede false values. Returns the boundary, O(n) time/O(1) storage, unstable.

pub fn partition<T, P>(data: &mut[T], predicate: &P) -> usize

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
?