pub struct NetConnection<E: 'static> {
    pub target: SocketAddr,
    pub state: ConnectionState,
    pub send_buffer: EventChannel<NetEvent<E>>,
    pub receive_buffer: EventChannel<NetEvent<E>>,
    /* private fields */
}
Expand description

A network connection target data.

Fields

target: SocketAddr

The remote socket address of this connection.

state: ConnectionState

The state of the connection.

send_buffer: EventChannel<NetEvent<E>>

The buffer of events to be sent.

receive_buffer: EventChannel<NetEvent<E>>

The buffer of events that have been received.

Implementations

Construct a new NetConnection. SocketAddr is the address that will be connected to.

Function used ONLY by NetSocketSystem. Since most users will want to both create the connection and send messages on the same frame, we need a way to read those. Since the NetSocketSystem runs after the creation of the NetConnection, it cannot possibly have registered his reader early enough to catch the initial messages that the user wants to send.

The downside of this is that you are forced to take NetConnection mutably inside of NetSocketSystem. If someone finds a better solution, please open a PR.

Trait Implementations

Associated storage type for this component.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.