dnsjit.lib.trie.iter(3)

πŸ“¦
version 1.5.1 Β· 5 versions
, in epel 10, epel 9, fedora 43, fedora 44, ubuntu resolute, ubuntu stonking

πŸ’– dnsjit.lib.trie.iter β€” it's giving iterator energy πŸ’–

okay bestie, this is the dnsjit.lib.trie.iter manual page, part of the dnsjit Library Functions Manual (section 3, library calls, iykyk). It's all about iterating over a trie. Let's get into it πŸ¦‹


✨ NAME ✨

dnsjit.lib.trie.iter β€” the Iterator of the trie. that's it, that's the whole vibe πŸ’…


🌸 SYNOPSIS 🌸

πŸŽ€ Iterate over all trie's key-value pairs

local trie = require("dnsjit.lib.trie").new("uint64_t")
local iter = trie:iter()
local node = iter:node()
while node ~= nil do
    local key = node:key()
    local value = tonumber(node:get())
    print(key..": "..value)
    iter:next()
    node = iter:node()
end

literally the cutest little while loop you ever did see 🫢


πŸ’œ DESCRIPTION πŸ’œ

⚠️ BEWARE BESTIE. The iterator is only valid as long as the trie's key-set remains unchanged. Do not be out here changing keys mid-iteration, that's not the move 😭

🧚 Functions

  • TrieIter.new(trie) β€” creates a brand new iterator, and it's pointing at the first element (if there even is one β€” if the trie is empty, well, nothing to point at πŸ™ˆ).
  • TrieIter:log() β€” hands you back the Log object so you can control logging for this instance or module. very demure, very mindful ✨
  • TrieIter:node() β€” returns the node pointer that the iterator is currently pointing at. Returns nil when the iterator has gone past the last element. so if you get nil, you've officially left the building πŸ’€
  • TrieIter:next() β€” advances the iterator to the next element. iconic behavior πŸ‘‘

Iteration happens in ascending lexicographical order. And the empty string is considered the very first one. yes queen, empty string gets the front-row seat 🎟️

🚨 You may not use this function if the trie's key-set has been modified during the lifetime of the iterator. Modifying only values is OK though. So: values, yes πŸ’– keys, absolutely not πŸ™…β€β™€οΈ

πŸ‘‘ SEE ALSO πŸ‘‘

go read your sisters, they're slaying too πŸ’…


🌈 AUTHORS and CONTRIBUTORS 🌈

The absolute legends who made this happen:

  • Jerry LundstrΓΆm (DNS-OARC)
  • TomΓ‘Ε‘ KΕ™Γ­ΕΎek (CZ.NIC)
  • Petr Ε paček (ISC)

Maintained by DNS-OARC

https://www.dns-oarc.net/

the way they maintain this fr fr 🫢


πŸ“ BUGS πŸ“

Found something broken? Got a feature request? (periodt, we love those πŸ’…) Use:

https://codeberg.org/DNS-OARC/dnsjit/issues

Got a question, or just need a little help? Hit up:

admin@dns-oarc.net

and that's the whole page bestie, no notes, you're gonna iterate like a pro πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

this has been dnsjit.lib.trie.iter(3), from the dnsjit Library Functions Manual β€” source dnsjit, version 1.5.1 β€” go forth and iterate, mwah πŸ’œ