Dazzle.Trie

Fields

None

Methods

class

new (value_destroy)

destroy ()

insert (key, value)

lookup (key)

ref ()

remove (key)

traverse (key, order, flags, max_depth, func, *user_data)

unref ()

Details

class Dazzle.Trie
classmethod new(value_destroy)
Parameters:

value_destroy (GLib.DestroyNotify) – A GLib.DestroyNotify, or None.

Returns:

A newly allocated Dazzle.Trie that should be freed with Dazzle.Trie.unref().

Return type:

Dazzle.Trie

Creates a new Dazzle.Trie. When a value is removed from the trie, value_destroy will be called to allow you to release any resources.

destroy()

This is an alias for Dazzle.Trie.unref().

insert(key, value)
Parameters:
  • key (str) – The key to insert.

  • value (object or None) – The value to insert.

Inserts value into self located with key.

lookup(key)
Parameters:

key (str) – The key to lookup.

Returns:

The value inserted or None.

Return type:

object or None

Looks up key in self and returns the value associated.

ref()
Return type:

Dazzle.Trie

remove(key)
Parameters:

key (str) – The key to remove.

Returns:

True if key was found, otherwise False.

Return type:

bool

Removes key from self, possibly destroying the value associated with the key.

traverse(key, order, flags, max_depth, func, *user_data)
Parameters:

Traverses all nodes of self according to the parameters. For each node matching the traversal parameters, func will be executed.

Only GLib.TraverseType.PRE_ORDER and GLib.TraverseType.POST_ORDER are supported for order.

If max_depth is less than zero, the entire tree will be traversed. If max_depth is 1, then only the root will be traversed.

unref()

Drops the reference count by one on self. When it reaches zero, the structure is freed.