Crate libdarts_sys

Source

Structs§

DartsResultPairType
Enables applications to get the lengths of the matched keys in addition to the values.

Functions§

darts_array
Returns a pointer to the array of units.
darts_build
Constructs a dictionary from given key-value pairs. If lengths is NULL, keys is handled as an array of zero-terminated strings. If values is NULL, the index in keys is associated with each key, i.e. the ith key has (i - 1) as its value.
darts_clear
Frees memory allocated to units and then initializes member variables with 0 and NULLs. Note that this does not free memory if the array of units was set by darts_set_array.
darts_common_prefix_search
Searches for keys which match a prefix of the given string. If length is 0, key is handled as a zero-terminated string. The values and the lengths of at most max_num_results matched keys are stored in results. Returns the number of matched keys. Note that the return value can be larger than max_num_results if there are more than max_num_results matches. If you want to get all the results, allocate more spaces and call this again. node_pos works as well as in darts_exact_match_search.
darts_delete
Frees an allocated double array trie.
darts_error
Returns the internal error. It could be NULL if there is no error.
darts_exact_match_search
Tests whether the given key exists or not, and if it exists, its value and length are returned. Otherwise, the value and the length of return value are set to -1 and 0 respectively.
darts_exact_match_search_pair
Returns a DartsResultPairType instead.
darts_new
Constructs an instance of double array trie.
darts_nonzero_size
Exists for compatibility. It always returns the number of units because it takes long time to count the number of non-zero units.
darts_open
Reads an array of units from the specified file. And if it goes well, the old array will be freed and replaced with the new array read from the file. offset specifies the number of bytes to be skipped before reading an array. size specifies the number of bytes to be read from the file. If the `size’ is 0, the whole file will be read.
darts_save
Writes the array of units into the specified file. `offset’ specifies the number of bytes to be skipped before writing the array. Returns 0 iff the operation succeeds. Otherwise, returns a non-zero value.
darts_set_array
Calls darts_clear in order to free memory allocated to the old array and then sets a new array. This function is useful to set a memory- mapped array.
darts_size
Returns the number of units. It can be 0 if darts_set_array is used.
darts_total_size
Returns the number of bytes allocated to the array of units. It can be 0 if darts_set_array is used.
darts_traverse
In Darts-clone, a dictionary is a deterministic finite-state automaton (DFA) and this tests transitions on the DFA. The initial state is node_pos and the function chooses transitions labeled key[key_pos], key[key_pos + 1], … in order. If there is not a transition labeled key[key_pos + i], the function terminates the transitions at that state and returns -2. Otherwise, the function ends without a termination and returns -1 or a nonnegative value, -1 indicates that the final state was not an accept state. When a nonnegative value is returned, it is the value associated with the final accept state. That is, the function returns the value associated with the given key if it exists. Note that the function updates node_pos and key_pos after each transition.
darts_unit_size
Returns the size of each unit.
darts_version
Returns version string of Darts.

Type Aliases§

DartsKeyType
Type of double array trie key.
DartsT
Type of double array instance.
DartsValueType
Type of double array trie value.