Enum carrier_pigeon::net::Status
source · [−]Expand description
An enum for the possible states of a connection.
Variants
Connected
The connection is still live.
Disconnected(Box<dyn Any + Send + Sync>)
The connection is closed because the peer disconnected by sending a disconnection message.
Closed
The connection is closed because we chose to close the connection.
Dropped(Error)
The connection was dropped without sending a disconnection message.
Implementations
sourceimpl Status
impl Status
sourcepub fn connected(&self) -> bool
pub fn connected(&self) -> bool
Returns whether the status is Status::Connected
.
sourcepub fn disconnected<D: Any + Send + Sync>(&self) -> Option<&D>
pub fn disconnected<D: Any + Send + Sync>(&self) -> Option<&D>
Turns this into an option with the disconnect message.
Panics
Panics if the generic parameter D
isn’t the disconnect message type (the same D
that
you passed into MsgTable::build
).
sourcepub fn disconnected_dyn(&self) -> Option<&Box<dyn Any + Send + Sync>>
pub fn disconnected_dyn(&self) -> Option<&Box<dyn Any + Send + Sync>>
Turns this into an option with the disconnect message.
sourcepub fn closed(&self) -> bool
pub fn closed(&self) -> bool
Returns whether the status is Status::Closed
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl !UnwindSafe for Status
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more