pub struct Ping { /* private fields */ }Expand description
Ping is our protocol struct.
We’ll implement ProtocolHandler on this struct so we can use it with
an iroh::protocol::Router.
It’s also fine to keep state in this struct for use across many incoming
connections, in this case we’ll keep metrics about the amount of pings we
sent or received.
Implementations§
Trait Implementations§
Source§impl ProtocolHandler for Ping
impl ProtocolHandler for Ping
Source§async fn accept(&self, connection: Connection) -> Result<(), AcceptError>
async fn accept(&self, connection: Connection) -> Result<(), AcceptError>
The accept method is called for each incoming connection for our ALPN.
The returned future runs on a newly spawned tokio task, so it can run as long as the connection lasts.
Source§fn on_accepting(
&self,
accepting: Accepting,
) -> impl Future<Output = Result<Connection, AcceptError>> + Send
fn on_accepting( &self, accepting: Accepting, ) -> impl Future<Output = Result<Connection, AcceptError>> + Send
Optional interception point to handle the
Accepting state. Read moreAuto Trait Implementations§
impl Freeze for Ping
impl RefUnwindSafe for Ping
impl Send for Ping
impl Sync for Ping
impl Unpin for Ping
impl UnwindSafe for Ping
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