pub enum PeerSlot {
Connecting(Box<PeerConnection>),
Active(Box<ActivePeer>),
}Expand description
A slot in the peer table, representing either connection or active phase.
Variants§
Connecting(Box<PeerConnection>)
Connection in handshake phase.
Active(Box<ActivePeer>)
Authenticated peer.
Implementations§
Source§impl PeerSlot
impl PeerSlot
Sourcepub fn outbound(conn: PeerConnection) -> Self
pub fn outbound(conn: PeerConnection) -> Self
Create a new connecting slot (outbound).
Sourcepub fn inbound(conn: PeerConnection) -> Self
pub fn inbound(conn: PeerConnection) -> Self
Create a new connecting slot (inbound).
Sourcepub fn active(peer: ActivePeer) -> Self
pub fn active(peer: ActivePeer) -> Self
Create a new active slot.
Sourcepub fn is_connecting(&self) -> bool
pub fn is_connecting(&self) -> bool
Check if this is a connecting slot.
Sourcepub fn as_connection(&self) -> Option<&PeerConnection>
pub fn as_connection(&self) -> Option<&PeerConnection>
Get as connection reference, if connecting.
Sourcepub fn as_connection_mut(&mut self) -> Option<&mut PeerConnection>
pub fn as_connection_mut(&mut self) -> Option<&mut PeerConnection>
Get as mutable connection reference, if connecting.
Sourcepub fn as_active(&self) -> Option<&ActivePeer>
pub fn as_active(&self) -> Option<&ActivePeer>
Get as active peer reference, if active.
Sourcepub fn as_active_mut(&mut self) -> Option<&mut ActivePeer>
pub fn as_active_mut(&mut self) -> Option<&mut ActivePeer>
Get as mutable active peer reference, if active.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PeerSlot
impl !RefUnwindSafe for PeerSlot
impl Send for PeerSlot
impl Sync for PeerSlot
impl Unpin for PeerSlot
impl UnsafeUnpin for PeerSlot
impl !UnwindSafe for PeerSlot
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> 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