Struct netstack3_base::socket::SocketIpAddr
source · 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>
§type Type = SocketIpAddr<<IpType as Ip>::Addr>
type Type = SocketIpAddr<<IpType as Ip>::Addr>
Self
when its IP-generic parameter is replaced with the
type NewIp
.source§impl<A: PartialEq + IpAddress> PartialEq for SocketIpAddr<A>
impl<A: PartialEq + IpAddress> PartialEq for SocketIpAddr<A>
source§fn eq(&self, other: &SocketIpAddr<A>) -> bool
fn eq(&self, other: &SocketIpAddr<A>) -> bool
self
and other
values to be equal, and is used
by ==
.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>
§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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)