pub enum KeepAliveLoop {
Client(Client, Duration),
Server(Server),
}Expand description
A keep-alive loop on either side of the connection.
Variants§
Client(Client, Duration)
Client-side loop: ping the peer at the given interval.
Server(Server)
Server-side loop: respond to pings from the peer.
Implementations§
Source§impl KeepAliveLoop
impl KeepAliveLoop
Sourcepub fn client(client: Client, interval: Duration) -> Self
pub fn client(client: Client, interval: Duration) -> Self
Build a client-side loop that pings every interval.
Sourcepub fn server(server: Server) -> Self
pub fn server(server: Server) -> Self
Build a server-side loop that responds to incoming pings.
Sourcepub async fn run_client(client: Client, interval: Duration) -> Result<(), Error>
pub async fn run_client(client: Client, interval: Duration) -> Result<(), Error>
Drive a client-side keep-alive loop until it errors.
Sourcepub async fn run_server(server: Server) -> Result<(), Error>
pub async fn run_server(server: Server) -> Result<(), Error>
Drive a server-side keep-alive loop until it errors.
Sourcepub fn spawn(self) -> KeepAliveHandle
pub fn spawn(self) -> KeepAliveHandle
Spawn the loop on the current Tokio runtime.
Auto Trait Implementations§
impl Freeze for KeepAliveLoop
impl RefUnwindSafe for KeepAliveLoop
impl Send for KeepAliveLoop
impl Sync for KeepAliveLoop
impl Unpin for KeepAliveLoop
impl UnsafeUnpin for KeepAliveLoop
impl UnwindSafe for KeepAliveLoop
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more