Skip to content

CobbCoding1/odin-hashmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Odin Hasmap

Hashmap implementation in Odin

Quick Start

cd odin-hashmap
odin run .

Functions

map_init :: proc($T: typeic) -> Map // Initialize a map with start capacity
map_insert :: proc(hashmap: ^Map($T), key: string, val: int) -> Errors // Insert element into map at key location
map_get :: proc(hashmap: ^Map($T), key: string) -> (int, Errors) // Get element from map at key location
map_delete :: proc(hashmap: ^Map($T), key: string) -> Errors // Delete element from map at key location
map_clear :: proc(hashmap: ^Map($T)) // Clear entire map
data_print :: proc(data: ^Data($T)) // Print single element of map (Data)
map_print :: proc(hashmap: ^Map($T)) // Print entire map

Example

hashmap := map_init(int)
err := map_insert(&hashmap, "key", 12)
if err != Errors.OK {
    // error
}
map_print(&hashmap) // prints the used elements in the map

See main.odin for larger example

About

Hashmap In Odin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages