pub struct SocketIpAddr<A: IpAddress>(/* private fields */);
Expand description
An IP address that witnesses all required properties of a socket address.
Requires SpecifiedAddr
because most contexts do not permit unspecified
addresses; those that do can hold a Option<SocketIpAddr>
.
Requires NonMappedAddr
because mapped addresses (i.e. ipv4-mapped-ipv6
addresses) are converted from their original IP version to their target IP
version when entering the stack.
Implementations§
Source§impl<A: IpAddress> SocketIpAddr<A>
impl<A: IpAddress> SocketIpAddr<A>
Sourcepub fn new(addr: A) -> Option<SocketIpAddr<A>>
pub fn new(addr: A) -> Option<SocketIpAddr<A>>
Constructs a SocketIpAddr
if the address is compliant, else None
.
Sourcepub fn new_from_witness(addr: NonMappedAddr<SpecifiedAddr<A>>) -> Self
pub fn new_from_witness(addr: NonMappedAddr<SpecifiedAddr<A>>) -> Self
Constructs a SocketIpAddr
from the inner witness.
Sourcepub const unsafe fn new_unchecked(addr: A) -> SocketIpAddr<A>
pub const unsafe fn new_unchecked(addr: A) -> SocketIpAddr<A>
Constructs a SocketIpAddr
without verify the address’s properties.
§Safety
Callers must ensure that the addr is both a SpecifiedAddr
and
a NonMappedAddr
.
Sourcepub const unsafe fn new_from_specified_unchecked(
addr: SpecifiedAddr<A>,
) -> SocketIpAddr<A>
pub const unsafe fn new_from_specified_unchecked( addr: SpecifiedAddr<A>, ) -> SocketIpAddr<A>
Like SocketIpAddr::new_unchecked
, but the address is specified.
§Safety
Callers must ensure that the addr is a NonMappedAddr
.
Sourcepub fn into_inner(self) -> NonMappedAddr<SpecifiedAddr<A>>
pub fn into_inner(self) -> NonMappedAddr<SpecifiedAddr<A>>
Returns the inner address, including all witness types.
Sourcepub fn new_from_multicast(addr: MulticastAddr<A>) -> SocketIpAddr<A>
pub fn new_from_multicast(addr: MulticastAddr<A>) -> SocketIpAddr<A>
Constructs a SocketIpAddr
from the given multicast address.
Source§impl SocketIpAddr<Ipv4Addr>
impl SocketIpAddr<Ipv4Addr>
Sourcepub fn new_ipv4_specified(addr: SpecifiedAddr<Ipv4Addr>) -> Self
pub fn new_ipv4_specified(addr: SpecifiedAddr<Ipv4Addr>) -> Self
Constructs a SocketIpAddr
from a given specified IPv4 address.
Source§impl SocketIpAddr<Ipv6Addr>
impl SocketIpAddr<Ipv6Addr>
Sourcepub fn new_from_ipv6_non_mapped_unicast(
addr: NonMappedAddr<UnicastAddr<Ipv6Addr>>,
) -> Self
pub fn new_from_ipv6_non_mapped_unicast( addr: NonMappedAddr<UnicastAddr<Ipv6Addr>>, ) -> Self
Constructs a SocketIpAddr
from the given [Ipv6DeviceAddr
].
Sourcepub fn new_from_ipv6_source(addr: Ipv6SourceAddr) -> Option<Self>
pub fn new_from_ipv6_source(addr: Ipv6SourceAddr) -> Option<Self>
Optionally constructs a SocketIpAddr
from the given
Ipv6SourceAddr
, returning None
if the given addr is Unspecified
.
Trait Implementations§
Source§impl<A: IpAddress> AsRef<SpecifiedAddr<A>> for SocketIpAddr<A>
impl<A: IpAddress> AsRef<SpecifiedAddr<A>> for SocketIpAddr<A>
Source§fn as_ref(&self) -> &SpecifiedAddr<A>
fn as_ref(&self) -> &SpecifiedAddr<A>
Source§impl<A: Clone + IpAddress> Clone for SocketIpAddr<A>
impl<A: Clone + IpAddress> Clone for SocketIpAddr<A>
Source§fn clone(&self) -> SocketIpAddr<A>
fn clone(&self) -> SocketIpAddr<A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<A: IpAddress> Debug for SocketIpAddr<A>
impl<A: IpAddress> Debug for SocketIpAddr<A>
Source§impl<A: IpAddress> Display for SocketIpAddr<A>
impl<A: IpAddress> Display for SocketIpAddr<A>
Source§impl<A: IpAddress> From<IpDeviceAddr<A>> for SocketIpAddr<A>
impl<A: IpAddress> From<IpDeviceAddr<A>> for SocketIpAddr<A>
Source§fn from(addr: IpDeviceAddr<A>) -> Self
fn from(addr: IpDeviceAddr<A>) -> Self
Source§impl<A: IpAddress> From<SocketIpAddr<A>> for SpecifiedAddr<A>
impl<A: IpAddress> From<SocketIpAddr<A>> for SpecifiedAddr<A>
Source§fn from(addr: SocketIpAddr<A>) -> Self
fn from(addr: SocketIpAddr<A>) -> Self
Source§impl<A: IpAddress, IpType: Ip> GenericOverIp<IpType> for SocketIpAddr<A>
impl<A: IpAddress, IpType: Ip> GenericOverIp<IpType> for SocketIpAddr<A>
Source§impl<A: IpAddress> ScopeableAddress for SocketIpAddr<A>
impl<A: IpAddress> ScopeableAddress for SocketIpAddr<A>
Allows SocketIpAddr
to be used inside of a ZonedAddr
.
Source§impl<A: IpAddress> TryFrom<SpecifiedAddr<A>> for SocketIpAddr<A>
impl<A: IpAddress> TryFrom<SpecifiedAddr<A>> for SocketIpAddr<A>
Source§type Error = AddrIsMappedError
type Error = AddrIsMappedError
impl<A: Copy + IpAddress> Copy for SocketIpAddr<A>
impl<A: Eq + IpAddress> Eq for SocketIpAddr<A>
impl<A: IpAddress> StructuralPartialEq for SocketIpAddr<A>
Auto Trait Implementations§
impl<A> Freeze for SocketIpAddr<A>where
A: Freeze,
impl<A> RefUnwindSafe for SocketIpAddr<A>where
A: RefUnwindSafe,
impl<A> Send for SocketIpAddr<A>
impl<A> Sync for SocketIpAddr<A>
impl<A> Unpin for SocketIpAddr<A>where
A: Unpin,
impl<A> UnwindSafe for SocketIpAddr<A>where
A: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)