Skip to main content

addhashnode

Function addhashnode 

Source
pub fn addhashnode<T>(ht: &mut HashMap<String, T>, nam: &str, value: T)
Expand description

Port of addhashnode(HashTable ht, char *nam, void *nodeptr) from Src/hashtable.c:157.

C body:

HashNode oldnode = addhashnode2(ht, nam, nodeptr);
if (oldnode) ht->freenode(oldnode);

Generic insert that drops the previous value at nam (Rust’s HashMap::insert returns the old value; dropping it runs the equivalent of freenode). For typed table-specific entry shapes use the table’s own add() method. addhashnode — see implementation.