Crate libdarts_sys

source

Structs§

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

Functions§

  • Returns a pointer to the array of units.
  • 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.
  • 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.
  • 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.
  • Frees an allocated double array trie.
  • Returns the internal error. It could be NULL if there is no error.
  • 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.
  • Returns a DartsResultPairType instead.
  • Constructs an instance of double array trie.
  • Exists for compatibility. It always returns the number of units because it takes long time to count the number of non-zero units.
  • 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.
  • 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.
  • 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.
  • Returns the number of units. It can be 0 if darts_set_array is used.
  • Returns the number of bytes allocated to the array of units. It can be 0 if darts_set_array is used.
  • 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.
  • Returns the size of each unit.
  • Returns version string of Darts.

Type Aliases§