pub struct Link { /* private fields */ }Expand description
A link to a remote endpoint over a transport.
Implementations§
Source§impl Link
impl Link
Sourcepub fn new(
link_id: LinkId,
transport_id: TransportId,
remote_addr: TransportAddr,
direction: LinkDirection,
base_rtt: Duration,
) -> Self
pub fn new( link_id: LinkId, transport_id: TransportId, remote_addr: TransportAddr, direction: LinkDirection, base_rtt: Duration, ) -> Self
Create a new link in Connecting state.
Sourcepub fn new_with_timestamp(
link_id: LinkId,
transport_id: TransportId,
remote_addr: TransportAddr,
direction: LinkDirection,
base_rtt: Duration,
created_at: u64,
) -> Self
pub fn new_with_timestamp( link_id: LinkId, transport_id: TransportId, remote_addr: TransportAddr, direction: LinkDirection, base_rtt: Duration, created_at: u64, ) -> Self
Create a link with a creation timestamp.
Sourcepub fn connectionless(
link_id: LinkId,
transport_id: TransportId,
remote_addr: TransportAddr,
direction: LinkDirection,
base_rtt: Duration,
) -> Self
pub fn connectionless( link_id: LinkId, transport_id: TransportId, remote_addr: TransportAddr, direction: LinkDirection, base_rtt: Duration, ) -> Self
Create a connectionless link (immediately connected).
For connectionless transports (UDP, Ethernet), links are immediately in the Connected state.
Sourcepub fn transport_id(&self) -> TransportId
pub fn transport_id(&self) -> TransportId
Get the transport ID.
Sourcepub fn remote_addr(&self) -> &TransportAddr
pub fn remote_addr(&self) -> &TransportAddr
Get the remote address.
Sourcepub fn direction(&self) -> LinkDirection
pub fn direction(&self) -> LinkDirection
Get the link direction.
Sourcepub fn created_at(&self) -> u64
pub fn created_at(&self) -> u64
Get the creation timestamp.
Sourcepub fn set_created_at(&mut self, timestamp: u64)
pub fn set_created_at(&mut self, timestamp: u64)
Set the creation timestamp.
Sourcepub fn set_connected(&mut self)
pub fn set_connected(&mut self)
Mark the link as connected.
Sourcepub fn set_disconnected(&mut self)
pub fn set_disconnected(&mut self)
Mark the link as disconnected.
Sourcepub fn set_failed(&mut self)
pub fn set_failed(&mut self)
Mark the link as failed.
Sourcepub fn is_operational(&self) -> bool
pub fn is_operational(&self) -> bool
Check if this link is operational.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if this link is in a terminal state.
Sourcepub fn effective_rtt(&self) -> Duration
pub fn effective_rtt(&self) -> Duration
Get effective RTT (measured if available, else base hint).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Link
impl RefUnwindSafe for Link
impl Send for Link
impl Sync for Link
impl Unpin for Link
impl UnsafeUnpin for Link
impl UnwindSafe for Link
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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