Skip to main content

Module collections

Module collections 

Source
Expand description

Rust std::collections exposed as R data structures.

Each collection is stored on the Interpreter struct in a Vec<CollectionObject>. R sees a collection as an integer ID with a class attribute (e.g. "hashmap", "btreemap", "hashset", "heap", "deque"). Functions like hashmap_set(), hashset_add(), heap_push(), etc. mutate the collection in place through the ID.

This gives R users O(1) hash lookups, ordered maps, priority queues, and deques โ€” data structures that have no native equivalent in base R.

Structsยง

OrdF64
Wrapper around f64 that implements Ord for use in BinaryHeap.

Enumsยง

CollectionObject
A single collection object stored on the interpreter.

Staticsยง

__INTERP_REG_INTERP_BTREEMAP ๐Ÿ”’
__INTERP_REG_INTERP_BTREEMAP_GET ๐Ÿ”’
__INTERP_REG_INTERP_BTREEMAP_HAS ๐Ÿ”’
__INTERP_REG_INTERP_BTREEMAP_KEYS ๐Ÿ”’
__INTERP_REG_INTERP_BTREEMAP_REMOVE ๐Ÿ”’
__INTERP_REG_INTERP_BTREEMAP_SET ๐Ÿ”’
__INTERP_REG_INTERP_BTREEMAP_SIZE ๐Ÿ”’
__INTERP_REG_INTERP_BTREEMAP_TO_LIST ๐Ÿ”’
__INTERP_REG_INTERP_BTREEMAP_VALUES ๐Ÿ”’
__INTERP_REG_INTERP_DEQUE ๐Ÿ”’
__INTERP_REG_INTERP_DEQUE_POP_BACK ๐Ÿ”’
__INTERP_REG_INTERP_DEQUE_POP_FRONT ๐Ÿ”’
__INTERP_REG_INTERP_DEQUE_PUSH_BACK ๐Ÿ”’
__INTERP_REG_INTERP_DEQUE_PUSH_FRONT ๐Ÿ”’
__INTERP_REG_INTERP_DEQUE_SIZE ๐Ÿ”’
__INTERP_REG_INTERP_DEQUE_TO_LIST ๐Ÿ”’
__INTERP_REG_INTERP_HASHMAP ๐Ÿ”’
__INTERP_REG_INTERP_HASHMAP_GET ๐Ÿ”’
__INTERP_REG_INTERP_HASHMAP_HAS ๐Ÿ”’
__INTERP_REG_INTERP_HASHMAP_KEYS ๐Ÿ”’
__INTERP_REG_INTERP_HASHMAP_REMOVE ๐Ÿ”’
__INTERP_REG_INTERP_HASHMAP_SET ๐Ÿ”’
__INTERP_REG_INTERP_HASHMAP_SIZE ๐Ÿ”’
__INTERP_REG_INTERP_HASHMAP_TO_LIST ๐Ÿ”’
__INTERP_REG_INTERP_HASHMAP_VALUES ๐Ÿ”’
__INTERP_REG_INTERP_HASHSET ๐Ÿ”’
__INTERP_REG_INTERP_HASHSET_ADD ๐Ÿ”’
__INTERP_REG_INTERP_HASHSET_DIFF ๐Ÿ”’
__INTERP_REG_INTERP_HASHSET_HAS ๐Ÿ”’
__INTERP_REG_INTERP_HASHSET_INTERSECT ๐Ÿ”’
__INTERP_REG_INTERP_HASHSET_REMOVE ๐Ÿ”’
__INTERP_REG_INTERP_HASHSET_SIZE ๐Ÿ”’
__INTERP_REG_INTERP_HASHSET_TO_VECTOR ๐Ÿ”’
__INTERP_REG_INTERP_HASHSET_UNION ๐Ÿ”’
__INTERP_REG_INTERP_HEAP ๐Ÿ”’
__INTERP_REG_INTERP_HEAP_PEEK ๐Ÿ”’
__INTERP_REG_INTERP_HEAP_POP ๐Ÿ”’
__INTERP_REG_INTERP_HEAP_PUSH ๐Ÿ”’
__INTERP_REG_INTERP_HEAP_SIZE ๐Ÿ”’

Functionsยง

collection_id ๐Ÿ”’
Extract a collection ID from an RValue (integer scalar, possibly with a class attribute).
collection_value ๐Ÿ”’
Build an integer scalar with a class attribute representing a collection.
interp_btreemap ๐Ÿ”’
Create an empty BTreeMap (ordered key-value store).
interp_btreemap_get ๐Ÿ”’
Look up a key in a BTreeMap, with an optional default.
interp_btreemap_has ๐Ÿ”’
Check whether a key exists in a BTreeMap.
interp_btreemap_keys ๐Ÿ”’
Return all keys of a BTreeMap as a sorted character vector.
interp_btreemap_remove ๐Ÿ”’
Remove a key from a BTreeMap, returning the old value.
interp_btreemap_set ๐Ÿ”’
Insert or update a key-value pair in a BTreeMap.
interp_btreemap_size ๐Ÿ”’
Return the number of key-value pairs in a BTreeMap.
interp_btreemap_to_list ๐Ÿ”’
Convert a BTreeMap to a named R list (in key-sorted order).
interp_btreemap_values ๐Ÿ”’
Return all values of a BTreeMap as a list (in key-sorted order).
interp_deque ๐Ÿ”’
Create an empty deque (double-ended queue of R values).
interp_deque_pop_back ๐Ÿ”’
Remove and return the last element of a deque.
interp_deque_pop_front ๐Ÿ”’
Remove and return the first element of a deque.
interp_deque_push_back ๐Ÿ”’
Append a value to the back of a deque.
interp_deque_push_front ๐Ÿ”’
Prepend a value to the front of a deque.
interp_deque_size ๐Ÿ”’
Return the number of elements in a deque.
interp_deque_to_list ๐Ÿ”’
Convert a deque to an R list.
interp_hashmap ๐Ÿ”’
Create an empty HashMap (unordered key-value store).
interp_hashmap_get ๐Ÿ”’
Look up a key in a HashMap, with an optional default.
interp_hashmap_has ๐Ÿ”’
Check whether a key exists in a HashMap.
interp_hashmap_keys ๐Ÿ”’
Return all keys of a HashMap as a character vector.
interp_hashmap_remove ๐Ÿ”’
Remove a key from a HashMap, returning the old value.
interp_hashmap_set ๐Ÿ”’
Insert or update a key-value pair in a HashMap.
interp_hashmap_size ๐Ÿ”’
Return the number of key-value pairs in a HashMap.
interp_hashmap_to_list ๐Ÿ”’
Convert a HashMap to a named R list.
interp_hashmap_values ๐Ÿ”’
Return all values of a HashMap as a list.
interp_hashset ๐Ÿ”’
Create an empty HashSet (unordered unique-element set).
interp_hashset_add ๐Ÿ”’
Add a string element to a HashSet.
interp_hashset_diff ๐Ÿ”’
Compute the difference of two HashSets (s1 minus s2), returning a new HashSet.
interp_hashset_has ๐Ÿ”’
Check whether a string element is in a HashSet.
interp_hashset_intersect ๐Ÿ”’
Compute the intersection of two HashSets, returning a new HashSet.
interp_hashset_remove ๐Ÿ”’
Remove a string element from a HashSet.
interp_hashset_size ๐Ÿ”’
Return the number of elements in a HashSet.
interp_hashset_to_vector ๐Ÿ”’
Convert a HashSet to a character vector.
interp_hashset_union ๐Ÿ”’
Compute the union of two HashSets, returning a new HashSet.
interp_heap ๐Ÿ”’
Create an empty max-heap (priority queue of numeric values).
interp_heap_peek ๐Ÿ”’
Peek at the maximum value in a max-heap without removing it.
interp_heap_pop ๐Ÿ”’
Pop and return the maximum value from a max-heap.
interp_heap_push ๐Ÿ”’
Push a numeric value onto a max-heap.
interp_heap_size ๐Ÿ”’
Return the number of elements in a max-heap.
require_string ๐Ÿ”’
Extract a string key from an argument at the given position.