pub struct BaseConnection<E: Copy + Eq + Hash + Send + Sync> {
    pub message_manager: MessageManager,
    pub host_world_manager: HostWorldManager<E>,
    pub remote_world_manager: RemoteWorldManager<E>,
    pub remote_world_reader: RemoteWorldReader<E>,
    pub local_world_manager: LocalWorldManager<E>,
    /* private fields */
}
Expand description

Represents a connection to a remote host, and provides functionality to manage the connection and the communications to it

Fields§

§message_manager: MessageManager§host_world_manager: HostWorldManager<E>§remote_world_manager: RemoteWorldManager<E>§remote_world_reader: RemoteWorldReader<E>§local_world_manager: LocalWorldManager<E>

Implementations§

source§

impl<E: Copy + Eq + Hash + Send + Sync> BaseConnection<E>

source

pub fn new( address: &Option<SocketAddr>, host_type: HostType, user_key: u64, connection_config: &ConnectionConfig, channel_kinds: &ChannelKinds, global_world_manager: &dyn GlobalWorldManagerType<E> ) -> Self

Create a new BaseConnection, given the appropriate underlying managers

source

pub fn mark_sent(&mut self)

Record that a message has been sent (to prevent needing to send a heartbeat)

source

pub fn should_send_heartbeat(&self) -> bool

Returns whether a heartbeat message should be sent

source

pub fn mark_heard(&mut self)

Record that a message has been received from a remote host (to prevent disconnecting from the remote host)

source

pub fn should_drop(&self) -> bool

Returns whether this connection should be dropped as a result of a timeout

source

pub fn process_incoming_header( &mut self, header: &StandardHeader, packet_notifiables: &mut [&mut dyn PacketNotifiable] )

Process an incoming packet, pulling out the packet index number to keep track of the current RTT, and sending the packet to the AckManager to handle packet notification events

source

pub fn write_header(&mut self, packet_type: PacketType, writer: &mut BitWriter)

Given a packet payload, start tracking the packet via it’s index, attach the appropriate header, and return the packet’s resulting underlying bytes

source

pub fn next_packet_index(&self) -> PacketIndex

Get the next outgoing packet’s index

source

pub fn collect_messages(&mut self, now: &Instant, rtt_millis: &f32)

source

pub fn write_packet<W: WorldRefType<E>>( &mut self, protocol: &Protocol, now: &Instant, writer: &mut BitWriter, packet_index: PacketIndex, world: &W, global_world_manager: &dyn GlobalWorldManagerType<E>, has_written: &mut bool, write_world_events: bool, host_world_events: &mut HostWorldEvents<E> )

source

pub fn read_packet( &mut self, protocol: &Protocol, client_tick: &Tick, global_world_manager: &dyn GlobalWorldManagerType<E>, read_world_events: bool, reader: &mut BitReader<'_> ) -> Result<(), SerdeErr>

source

pub fn remote_entities(&self) -> Vec<E>

Auto Trait Implementations§

§

impl<E> !RefUnwindSafe for BaseConnection<E>

§

impl<E> Send for BaseConnection<E>

§

impl<E> Sync for BaseConnection<E>

§

impl<E> Unpin for BaseConnection<E>
where E: Unpin,

§

impl<E> !UnwindSafe for BaseConnection<E>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
§

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

§

fn vzip(self) -> V