Struct amethyst_network::NetConnection
source · 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
sourceimpl<E: Send + Sync + 'static> NetConnection<E>
impl<E: Send + Sync + 'static> NetConnection<E>
sourcepub fn new(target: SocketAddr) -> Self
pub fn new(target: SocketAddr) -> Self
Construct a new NetConnection. SocketAddr
is the address that will be connected to.
sourcepub fn send_buffer_early_read(&mut self) -> EventIterator<'_, NetEvent<E>>
pub fn send_buffer_early_read(&mut self) -> EventIterator<'_, NetEvent<E>>
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
sourceimpl<E: Send + Sync + 'static> Component for NetConnection<E>
impl<E: Send + Sync + 'static> Component for NetConnection<E>
type Storage = VecStorage<NetConnection<E>>
type Storage = VecStorage<NetConnection<E>>
sourceimpl<E> PartialEq<NetConnection<E>> for NetConnection<E>
impl<E> PartialEq<NetConnection<E>> for NetConnection<E>
sourceimpl<E: 'static> Serialize for NetConnection<E>
impl<E: 'static> Serialize for NetConnection<E>
impl<E: PartialEq> Eq for NetConnection<E>
Auto Trait Implementations
impl<E> !RefUnwindSafe for NetConnection<E>
impl<E> Send for NetConnection<E>where
E: Send + Sync,
impl<E> Sync for NetConnection<E>where
E: Sync,
impl<E> Unpin for NetConnection<E>where
E: Unpin,
impl<E> UnwindSafe for NetConnection<E>where
E: UnwindSafe + RefUnwindSafe,
Blanket Implementations
impl<T> Any for Twhere
T: Any,
impl<T> Any for Twhere
T: Any,
fn get_type_id(&self) -> TypeId
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read morefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.