darts_traverse

Function darts_traverse 

Source
pub unsafe extern "C" fn darts_traverse(
    darts: DartsT,
    key: *const DartsKeyType,
    node_pos: *mut size_t,
    key_pos: *mut size_t,
    length: size_t,
) -> DartsValueType
Expand description

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.