Struct AddrParseError
pub struct AddrParseError(pub(in ::net::parser) AddrKind);
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 SocketAddr;
// No problem, the `panic!` message has disappeared.
let _foo: SocketAddr = "127.0.0.1:8080".parse.expect;
Fields
0: AddrKind
Trait Implementations
impl Clone for AddrParseError
fn clone(&self) -> AddrParseError
impl Debug for AddrParseError
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for AddrParseError
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for AddrParseError
fn assert_fields_are_eq(&self)
impl Error for AddrParseError
impl PartialEq for AddrParseError
fn eq(&self, other: &AddrParseError) -> bool
impl StructuralPartialEq for AddrParseError
Auto Trait Implementations
impl Freeze for AddrParseError
impl RefUnwindSafe for AddrParseError
impl Send for AddrParseError
impl Sync for AddrParseError
impl Unpin for AddrParseError
impl UnsafeUnpin for AddrParseError
impl UnwindSafe for AddrParseError
Blanket Implementations
impl<T> Any for AddrParseError
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for AddrParseError
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for AddrParseError
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for AddrParseError
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for AddrParseError
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for AddrParseError
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for AddrParseError
impl<T, U> Into<U> for AddrParseError
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for AddrParseError
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for AddrParseError
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>