pub enum AddressKey {
Ipv4Individual(Ipv4Addr),
Ipv4Network([u8; 3]),
Ipv6Subnet([u8; 8]),
Ipv6Provider([u8; 6]),
}Expand description
Represents the hierarchical address level being limited
Variants§
Ipv4Individual(Ipv4Addr)
IPv4 individual (/32)
Ipv4Network([u8; 3])
IPv4 /24 network (C-class)
Ipv6Subnet([u8; 8])
IPv6 /64 subnet (standard allocation)
Ipv6Provider([u8; 6])
IPv6 /48 provider allocation
Implementations§
Source§impl AddressKey
impl AddressKey
Sourcepub fn from_ip_individual(addr: &IpAddr) -> Self
pub fn from_ip_individual(addr: &IpAddr) -> Self
Create individual key from IP address For IPv6, returns /64 subnet since /128 tracking is not supported
Sourcepub fn from_ip_network(addr: &IpAddr) -> Self
pub fn from_ip_network(addr: &IpAddr) -> Self
Create network key from IP address (IPv4 /24 or IPv6 /64)
Sourcepub fn from_ipv6_provider(addr: &IpAddr) -> Option<Self>
pub fn from_ipv6_provider(addr: &IpAddr) -> Option<Self>
Create provider key from IPv6 address (/48) Returns None for IPv4 addresses
Sourcepub fn extract_all(addr: &IpAddr) -> Vec<Self>
pub fn extract_all(addr: &IpAddr) -> Vec<Self>
Extract all applicable hierarchical keys for an address
Sourcepub fn is_individual(&self) -> bool
pub fn is_individual(&self) -> bool
Check if this is an individual-level key (IPv4 only, IPv6 uses /64)
Sourcepub fn is_network(&self) -> bool
pub fn is_network(&self) -> bool
Check if this is a network-level key
Sourcepub fn is_provider(&self) -> bool
pub fn is_provider(&self) -> bool
Check if this is a provider-level key
Sourcepub fn level_name(&self) -> &'static str
pub fn level_name(&self) -> &'static str
Get address level name for logging/responses
Trait Implementations§
Source§impl Clone for AddressKey
impl Clone for AddressKey
Source§fn clone(&self) -> AddressKey
fn clone(&self) -> AddressKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AddressKey
impl Debug for AddressKey
Source§impl Hash for AddressKey
impl Hash for AddressKey
Source§impl PartialEq for AddressKey
impl PartialEq for AddressKey
impl Eq for AddressKey
impl StructuralPartialEq for AddressKey
Auto Trait Implementations§
impl Freeze for AddressKey
impl RefUnwindSafe for AddressKey
impl Send for AddressKey
impl Sync for AddressKey
impl Unpin for AddressKey
impl UnsafeUnpin for AddressKey
impl UnwindSafe for AddressKey
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more