v/vlib/datatypes
2025-03-14 19:47:13 +02:00
..
fsm datatypes.fsm: add missing doc comments for public methods (#23865) 2025-03-05 14:38:55 +02:00
bloom_filter.v fmt: remove the prefixed module name of const names, that are in the same module (related #22183) (#22185) 2024-09-10 11:25:56 +03:00
bloom_filter_test.v all: fix typos (#19693) 2023-10-30 03:28:34 +02:00
bstree.v vlib: reduce false positive matches for /// , cleanup commented code 2025-03-08 17:47:13 +02:00
bstree_test.v all: fix typos (#21089) 2024-03-25 12:18:27 +02:00
doubly_linked_list.v datatypes: make Direction pub and fix and add tests for push_many (#19983) 2023-11-24 16:10:00 +02:00
doubly_linked_list_test.v datatypes: make Direction pub and fix and add tests for push_many (#19983) 2023-11-24 16:10:00 +02:00
heap.v datatypes: add push_many for doubly and singly linked list + add insert_many for heap (#19975) 2023-11-24 09:40:08 +02:00
heap_test.v datatypes: add push_many for doubly and singly linked list + add insert_many for heap (#19975) 2023-11-24 09:40:08 +02:00
linked_list.v datatypes: optimize linkedlist (fix #23928) (#23934) 2025-03-14 19:47:13 +02:00
linked_list_test.v datatypes: optimize linkedlist (fix #23928) (#23934) 2025-03-14 19:47:13 +02:00
quadtree.v fmt: fix alignment of struct init fields (#22025) 2024-08-11 09:11:24 +03:00
quadtree_test.v fmt: fix alignment of struct init fields (#22025) 2024-08-11 09:11:24 +03:00
queue.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00
queue_test.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00
README.md datatypes: add Bloom filter (#18327) 2023-06-02 10:56:22 +03:00
ringbuffer.v datatypes: improve the doc strings for RingBuffer and its methods (#19464) 2023-09-28 19:07:26 +03:00
ringbuffer_test.v all: replace generic <> with [] - part 2 (#16536) 2022-11-26 18:23:26 +02:00
set.v datatypes: fix for set - operator, union and intersection, now they no longer change the receiver (fix #21315) (#21362) 2024-05-01 22:05:24 +03:00
set_test.v datatypes: fix for set - operator, union and intersection, now they no longer change the receiver (fix #21315) (#21362) 2024-05-01 22:05:24 +03:00
stack.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00
stack_test.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00

datatypes

This module provides implementations of less frequently used, but still common data types.

V's builtin module is imported implicitly, and has implementations for arrays, maps and strings. These are good for many applications, but there are a plethora of other useful data structures/containers, like linked lists, priority queues, trees, etc, that allow for algorithms with different time complexities, which may be more suitable for your specific application.

It is implemented using generics, that you have to specialise for the type of your actual elements. For example:

import datatypes

mut stack := datatypes.Stack[int]{}
stack.push(1)
println(stack)

Currently Implemented Datatypes:

  • Linked list
  • Doubly linked list
  • Stack (LIFO)
  • Queue (FIFO)
  • Min heap (priority queue)
  • Set
  • Quadtree
  • Bloom filter
  • ...