pub struct BaseConnection<E: Copy + Eq + Hash + Send + Sync> {
    pub message_manager: MessageManager,
    pub host_world_manager: HostWorldManager<E>,
    pub remote_world_manager: RemoteWorldManager,
    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§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, 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_outgoing_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 has_outgoing_messages(&self) -> bool

source

pub fn collect_outgoing_messages( &mut self, now: &Instant, rtt_millis: &f32, handle_converter: &dyn EntityHandleConverter<E>, message_kinds: &MessageKinds )

source

pub fn write_outgoing_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 )

source

pub fn despawn_all_remote_entities<W: WorldMutType<E>>( &mut self, global_world_manager: &mut dyn GlobalWorldManagerType<E>, world: &mut W ) -> Vec<EntityEvent<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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

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

§

fn vzip(self) -> V