#[non_exhaustive]pub enum PartialSocketAddr {
IPv4(Ipv4Addr, Option<u16>),
IPv6(Ipv6Addr, Option<u16>),
}
Expand description
A universal address covering IPv4, IPv6 and Tor in a single byte sequence of 32 bytes, which may contain optional port number part.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
IPv4(Ipv4Addr, Option<u16>)
IP address of V4 standard with optional port number
IPv6(Ipv6Addr, Option<u16>)
IP address of V6 standard with optional port number
Implementations§
Source§impl PartialSocketAddr
impl PartialSocketAddr
Sourcepub fn socket(ip: IpAddr, port: Option<u16>) -> Self
pub fn socket(ip: IpAddr, port: Option<u16>) -> Self
Constructs new socket address from an internet address and a port information
Sourcepub fn is_tor(self) -> bool
pub fn is_tor(self) -> bool
Determines whether provided address is a Tor address. Always returns
false
(the library is built without tor
feature; use it to
enable Tor addresses).
Sourcepub fn onion_address(self) -> Option<()>
pub fn onion_address(self) -> Option<()>
Always returns Option::None
(the library is built without tor
feature; use it to enable Tor addresses).
Sourcepub fn port(self) -> Option<u16>
pub fn port(self) -> Option<u16>
Returns port for the socket, if address allows different ports.
Sourcepub fn inet_socket(self, default_port: u16) -> InetSocketAddr
pub fn inet_socket(self, default_port: u16) -> InetSocketAddr
Constructs InetSocketAddr
using default port information.
Trait Implementations§
Source§impl Clone for PartialSocketAddr
impl Clone for PartialSocketAddr
Source§fn clone(&self) -> PartialSocketAddr
fn clone(&self) -> PartialSocketAddr
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PartialSocketAddr
impl Debug for PartialSocketAddr
Source§impl Default for PartialSocketAddr
impl Default for PartialSocketAddr
Source§impl Display for PartialSocketAddr
impl Display for PartialSocketAddr
Source§impl From<InetAddr> for PartialSocketAddr
impl From<InetAddr> for PartialSocketAddr
Source§impl From<InetSocketAddr> for PartialSocketAddr
impl From<InetSocketAddr> for PartialSocketAddr
Source§fn from(addr: InetSocketAddr) -> Self
fn from(addr: InetSocketAddr) -> Self
Converts to this type from the input type.
Source§impl From<IpAddr> for PartialSocketAddr
impl From<IpAddr> for PartialSocketAddr
Source§impl From<Ipv4Addr> for PartialSocketAddr
impl From<Ipv4Addr> for PartialSocketAddr
Source§impl From<Ipv6Addr> for PartialSocketAddr
impl From<Ipv6Addr> for PartialSocketAddr
Source§impl From<SocketAddr> for PartialSocketAddr
impl From<SocketAddr> for PartialSocketAddr
Source§fn from(value: SocketAddr) -> Self
fn from(value: SocketAddr) -> Self
Converts to this type from the input type.
Source§impl From<SocketAddrV4> for PartialSocketAddr
impl From<SocketAddrV4> for PartialSocketAddr
Source§fn from(value: SocketAddrV4) -> Self
fn from(value: SocketAddrV4) -> Self
Converts to this type from the input type.
Source§impl From<SocketAddrV6> for PartialSocketAddr
impl From<SocketAddrV6> for PartialSocketAddr
Source§fn from(value: SocketAddrV6) -> Self
fn from(value: SocketAddrV6) -> Self
Converts to this type from the input type.
Source§impl FromStr for PartialSocketAddr
impl FromStr for PartialSocketAddr
Source§impl Hash for PartialSocketAddr
impl Hash for PartialSocketAddr
Source§impl Ord for PartialSocketAddr
impl Ord for PartialSocketAddr
Source§impl PartialEq for PartialSocketAddr
impl PartialEq for PartialSocketAddr
Source§impl PartialOrd for PartialSocketAddr
impl PartialOrd for PartialSocketAddr
Source§impl TryFrom<&str> for PartialSocketAddr
impl TryFrom<&str> for PartialSocketAddr
impl Copy for PartialSocketAddr
impl Eq for PartialSocketAddr
impl StructuralPartialEq for PartialSocketAddr
Auto Trait Implementations§
impl Freeze for PartialSocketAddr
impl RefUnwindSafe for PartialSocketAddr
impl Send for PartialSocketAddr
impl Sync for PartialSocketAddr
impl Unpin for PartialSocketAddr
impl UnwindSafe for PartialSocketAddr
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