Struct AddrParseError

struct AddrParseError(_)

An error which can be returned when parsing an IP address or a socket address.

This error is used as the error type for the FromStr implementation for IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, and SocketAddrV6.

Potential causes

AddrParseError may be thrown because the provided string does not parse as the given type, often because it includes information only handled by a different address type.

use std::net::IpAddr;
let _foo: IpAddr = "127.0.0.1:8080".parse().expect("Cannot handle the socket port");

IpAddr doesn't handle the port. Use SocketAddr instead.

use std::net::SocketAddr;

// No problem, the `panic!` message has disappeared.
let _foo: SocketAddr = "127.0.0.1:8080".parse().expect("unreachable panic");

Implementations

impl Clone for AddrParseError

fn clone(self: &Self) -> AddrParseError

impl Debug for AddrParseError

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Display for AddrParseError

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Eq for AddrParseError

impl Error for AddrParseError

impl Freeze for AddrParseError

impl PartialEq for AddrParseError

fn eq(self: &Self, other: &AddrParseError) -> bool

impl RefUnwindSafe for AddrParseError

impl Send for AddrParseError

impl StructuralPartialEq for AddrParseError

impl Sync for AddrParseError

impl Unpin for AddrParseError

impl UnsafeUnpin for AddrParseError

impl UnwindSafe for AddrParseError

impl<T> Any for AddrParseError

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for AddrParseError

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for AddrParseError

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for AddrParseError

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for AddrParseError

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for AddrParseError

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for AddrParseError

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for AddrParseError

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>