3 ms·
By looking at the source code [1] they have a discriminated union with 3 variants representing the possible combinations of representing a valid word and leadin
by SkiFire13 2y ago
By looking at the source code [1] they have a discriminated union with 3 variants representing the possible combinations of representing a valid word and leading to more nodes (excluding the case where it is neither, which is impossible). So the node for the 'o' in "do" should be a `SearchOrLeaf` storing "do", its corresponding value (the `T`, in a set this would be empty) and the `SearchNode` containing the successors, which should only contain a 't' to "dot".
[1]: https://github.com/cloudflare/trie-hard/blob/3d8163ca2d9208c663d6dbac48105a96ac540306/src/lib.rs#L114 https://github.com/cloudflare/trie-hard/blob/3d8163ca2d9208c...