Skip to content

feat: add reference for IpCidr and IpNet#20

Closed
Sherlock-Holo wants to merge 1 commit into
stbuehler:masterfrom
Sherlock-Holo:ref-feature
Closed

feat: add reference for IpCidr and IpNet#20
Sherlock-Holo wants to merge 1 commit into
stbuehler:masterfrom
Sherlock-Holo:ref-feature

Conversation

@Sherlock-Holo
Copy link
Copy Markdown
Contributor

Currently IpCidr and IpNet will return the first_address/address directly, it's ok, but when if we want to use IpCidr as radix trie key, many radix trie implement require the key type can borrowed as &[u8], however we can't return a the local variable(the IpAddr) reference. With this PR we can borrow the IpAddr in IpCidr/IpNet directly to avoid this problem

Currently IpCidr and IpNet will return the first_address/address
directly, it's ok, but when if we want to use IpCidr as radix trie key,
many radix trie implement require the key type can borrowed as &[u8],
however we can't return a the local variable(the IpAddr) reference. With
this PR we can borrow the IpAddr in IpCidr/IpNet directly to avoid this
problem
@stbuehler
Copy link
Copy Markdown
Owner

Sounds reasonable; I don't think the underlying storage is going to change, to adding this API should be future-proof.

Merged in c9f557b

Thanks!

@stbuehler stbuehler closed this Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants