pub struct IpError { /* private fields */ }
Expand description
The IpError type is the only error type that can be returned from this crate’s API.
Implementations§
source§impl IpError
impl IpError
sourcepub fn new(kind: IpErrorKind, description: Option<&str>) -> Self
pub fn new(kind: IpErrorKind, description: Option<&str>) -> Self
Create a new error object with an optional error message.
Examples
use ipinfo::{IpError, IpErrorKind};
let err = IpError::new(IpErrorKind::HTTPClientError, None);
sourcepub fn kind(&self) -> IpErrorKind
pub fn kind(&self) -> IpErrorKind
Get IpErrorKind for this error.
Examples
use ipinfo::{IpError, IpErrorKind};
let err = IpError::new(IpErrorKind::HTTPClientError, None);
assert_eq!(err.kind(), IpErrorKind::HTTPClientError);
Trait Implementations§
source§impl Error for IpError
impl Error for IpError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl From<IpErrorKind> for IpError
impl From<IpErrorKind> for IpError
source§fn from(kind: IpErrorKind) -> Self
fn from(kind: IpErrorKind) -> Self
Converts to this type from the input type.
source§impl PartialEq for IpError
impl PartialEq for IpError
impl StructuralPartialEq for IpError
Auto Trait Implementations§
impl RefUnwindSafe for IpError
impl Send for IpError
impl Sync for IpError
impl Unpin for IpError
impl UnwindSafe for IpError
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