1use std::time::Duration;
2
3use mm1_address::address::Address;
4use mm1_common::errors::error_of::ErrorOf;
5use mm1_common::impl_error_kind;
6use mm1_proto::message;
7
8pub trait Ping: Send {
9 fn ping(
11 &mut self,
12 address: Address,
13 timeout: Duration,
14 ) -> impl Future<Output = Result<Duration, ErrorOf<PingErrorKind>>> + Send;
15}
16
17#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
18#[message(base_path = ::mm1_proto)]
19pub enum PingErrorKind {
20 Timeout,
21 Send,
22 Recv,
23}
24
25impl_error_kind!(PingErrorKind);