pub enum Family {
V6,
V4,
}Expand description
An IP address family: IPv6 (preferred) or IPv4 (fallback).
This is the axis the whole crate reasons over — local capability, peer reachability, dial order,
and the winning connection are all expressed in terms of a Family. IPv6 sorts before IPv4
everywhere so the ecosystem’s IPv6-first rule (CLAUDE.md §5.2) falls out of the ordinary
Ord/PartialOrd derive.
Variants§
Implementations§
Source§impl Family
impl Family
Sourcepub const PREFERENCE: [Family; 2]
pub const PREFERENCE: [Family; 2]
The preference-ordered list of both families, IPv6 first.
Sourcepub fn of(addr: &SocketAddr) -> Family
pub fn of(addr: &SocketAddr) -> Family
The family of a socket address.
An IPv4-mapped IPv6 address (::ffff:a.b.c.d) is classified as Family::V4: it is IPv4
reachability wearing an IPv6 costume, so treating it as V6 would let an IPv6-only host think
it can reach a v4-only peer. Canonicalizing first keeps the family tag honest.
Trait Implementations§
impl Copy for Family
impl Eq for Family
Source§impl Ord for Family
impl Ord for Family
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Family
impl PartialOrd for Family
impl StructuralPartialEq for Family
Auto Trait Implementations§
impl Freeze for Family
impl RefUnwindSafe for Family
impl Send for Family
impl Sync for Family
impl Unpin for Family
impl UnsafeUnpin for Family
impl UnwindSafe for Family
Blanket Implementations§
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