Skip to main content

MessageManager

Struct MessageManager 

Source
pub struct MessageManager { /* private fields */ }
Expand description

Handles incoming/outgoing messages, tracks the delivery status of Messages so that guaranteed Messages can be re-transmitted to the remote host

Implementations§

Source§

impl MessageManager

Source

pub fn new(host_type: HostType, channel_kinds: &ChannelKinds) -> Self

Creates a new MessageManager

Source

pub fn send_message( &mut self, message_kinds: &MessageKinds, converter: &mut dyn LocalEntityAndGlobalEntityConverterMut, channel_kind: &ChannelKind, message: MessageContainer, ) -> bool

Queues a Message to be transmitted to the remote host. Returns true if the message was accepted, false if the channel queue was full and the message was dropped (reliable channels only — unreliable channels always return true, evicting the oldest queued message if needed).

Source

pub fn send_request( &mut self, message_kinds: &MessageKinds, converter: &mut dyn LocalEntityAndGlobalEntityConverterMut, channel_kind: &ChannelKind, global_request_id: GlobalRequestId, request: MessageContainer, )

Queues a request with global_request_id into the given channel’s send buffer.

Source

pub fn send_response( &mut self, message_kinds: &MessageKinds, converter: &mut dyn LocalEntityAndGlobalEntityConverterMut, channel_kind: &ChannelKind, local_response_id: LocalResponseId, response: MessageContainer, )

Queues a response keyed by local_response_id into the given channel’s send buffer.

Source

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

Advances all channel senders, re-queuing any messages due for retransmission given current RTT.

Source

pub fn has_outgoing_messages(&self) -> bool

Returns whether the Manager has queued Messages that can be transmitted to the remote host

Source

pub fn write_messages( &mut self, channel_kinds: &ChannelKinds, message_kinds: &MessageKinds, converter: &mut dyn LocalEntityAndGlobalEntityConverterMut, writer: &mut BitWriter, packet_index: PacketIndex, has_written: &mut bool, )

Encodes all pending outgoing messages across all channels into writer, ordered by channel criticality.

Source

pub fn read_messages( &mut self, channel_kinds: &ChannelKinds, message_kinds: &MessageKinds, local_world_manager: &mut LocalWorldManager, reader: &mut BitReader<'_>, ) -> Result<(), SerdeErr>

Parses an incoming message packet, routing each message to its channel’s receiver buffer.

Source

pub fn receive_messages( &mut self, message_kinds: &MessageKinds, now: &Instant, entity_converter: &dyn LocalEntityAndGlobalEntityConverter, entity_waitlist: &mut RemoteEntityWaitlist, ) -> Vec<(ChannelKind, Vec<MessageContainer>)>

Retrieve all messages from the channel buffers

Source

pub fn receive_requests_and_responses( &mut self, ) -> (Vec<(ChannelKind, Vec<(LocalResponseId, MessageContainer)>)>, Vec<(GlobalRequestId, MessageContainer)>)

Retrieve all requests from the channel buffers

Trait Implementations§

Source§

impl PacketNotifiable for MessageManager

Source§

fn notify_packet_delivered(&mut self, packet_index: PacketIndex)

Occurs when a packet has been notified as delivered. Stops tracking the status of Messages in that packet.

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

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