Enum ConnectionState

Source
pub enum ConnectionState {
    Connecting,
    Connected,
    TimingOut,
    Disconnecting,
    Disconnected,
    Unidentified,
    Identified,
    Offline,
}
Expand description

Connection States These are all possible states of a raknet session, and while accessible externally Please note that these are not states relied on within the original implementation of raknet, which preserve both “Unconnected” and “Connected”

Variants§

§

Connecting

The Session is not yet connected, but is actively trying to connect. Clients in this state are considered to be actively trying to connect.

§

Connected

The Session is connected and ready to send and receive packets. This is the state after a connection has been established.

This state is applied once the ConnectionHandshake has been completed.

§

TimingOut

The session is being timed out because it has not sent a packet in a while. The interval for this can be set in the Session Options.

§

Disconnecting

The session has been disconnected but is still in the process of cleaning up. This is the state after a disconnect has been requested, but the client still wants to send packets until its done.

§

Disconnected

The session has been disconnected and is ready to be removed. This is the state after a disconnect has been requested and the client has This is almost never used.

§

Unidentified

The session is replying to the server but is not actually connected. This is the state where ping and pong packets are being sent. Similarly, this is the “Unconnected” state, hence “UnconnectedPing”

§

Identified

The session has been identified and is ready to be connected. This is the state after a connection has been established.

§

Offline

The session is not connected and is not trying to connect. During this state the session will be dropped. This state occurs when a client has completely stopped responding to packets or their socket is destroyed. This is not the same as the Disconnected state.

Implementations§

Source§

impl ConnectionState

Source

pub fn is_reliable(&self) -> bool

Returns whether or not the Session is reliable. Reliable sessions are sessions that are not:

  • Offline
  • Disconnected
  • TimingOut
Source

pub fn is_available(&self) -> bool

Returns whether or not the Session is available to recieve packets. Sessions in this state are:

  • Connected
  • Connecting
  • Unidentified
  • Disconnecting
Source

pub fn is_connected(&self) -> bool

Returns whether or not the Session is in any “connected” state. Sessions in this state are:

  • Connected
  • Connecting

Trait Implementations§

Source§

impl Clone for ConnectionState

Source§

fn clone(&self) -> ConnectionState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConnectionState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ConnectionState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ConnectionState

Source§

fn eq(&self, other: &ConnectionState) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for ConnectionState

Source§

fn partial_cmp(&self, other: &ConnectionState) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for ConnectionState

Source§

impl StructuralPartialEq for ConnectionState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V