pub struct KissOfDeathError {
pub code: KissOfDeath,
}Expand description
Error returned when the server responds with a Kiss-o’-Death (KoD) packet.
Per RFC 5905 Section 7.4, recipients of kiss codes MUST inspect them and take
the described actions. This error is returned as the inner error of an
io::Error with kind io::ErrorKind::ConnectionRefused, and can be
extracted via io::Error::get_ref and downcast_ref.
§Caller Responsibilities
- DENY / RSTR: The caller MUST stop sending packets to this server.
- RATE: The caller MUST reduce its polling interval before retrying.
§Examples
match ntp::request("time.nist.gov:123") {
Ok(result) => println!("Offset: {:.6}s", result.offset_seconds),
Err(e) => {
if let Some(kod) = e.get_ref().and_then(|inner| inner.downcast_ref::<ntp::KissOfDeathError>()) {
eprintln!("Kiss-o'-Death: {:?}", kod.code);
}
}
}Fields§
§code: KissOfDeathThe specific kiss code received from the server.
Trait Implementations§
Source§impl Clone for KissOfDeathError
impl Clone for KissOfDeathError
Source§fn clone(&self) -> KissOfDeathError
fn clone(&self) -> KissOfDeathError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KissOfDeathError
impl Debug for KissOfDeathError
Source§impl Display for KissOfDeathError
Available on crate feature std only.
impl Display for KissOfDeathError
Available on crate feature
std only.Source§impl Error for KissOfDeathError
Available on crate feature std only.
impl Error for KissOfDeathError
Available on crate feature
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns 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()
impl Copy for KissOfDeathError
Auto Trait Implementations§
impl Freeze for KissOfDeathError
impl RefUnwindSafe for KissOfDeathError
impl Send for KissOfDeathError
impl Sync for KissOfDeathError
impl Unpin for KissOfDeathError
impl UnsafeUnpin for KissOfDeathError
impl UnwindSafe for KissOfDeathError
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