pub struct InMemoryTransportHub { /* private fields */ }Expand description
Shared bounded in-memory client packet hub.
Implementations§
Source§impl InMemoryTransportHub
impl InMemoryTransportHub
Sourcepub fn new(limits: ClientTransportLimits) -> Self
pub fn new(limits: ClientTransportLimits) -> Self
Creates an empty in-memory transport hub.
Sourcepub fn register_client(
&self,
client_id: ClientId,
remote_addr: SocketAddr,
) -> Result<Option<SocketAddr>, InMemoryTransportError>
pub fn register_client( &self, client_id: ClientId, remote_addr: SocketAddr, ) -> Result<Option<SocketAddr>, InMemoryTransportError>
Registers a client endpoint address.
Sourcepub fn endpoint(
&self,
client_id: ClientId,
remote_addr: SocketAddr,
) -> Result<InMemoryTransportEndpoint, InMemoryTransportError>
pub fn endpoint( &self, client_id: ClientId, remote_addr: SocketAddr, ) -> Result<InMemoryTransportEndpoint, InMemoryTransportError>
Registers and returns a local endpoint for a client.
Sourcepub fn endpoint_for_registered(
&self,
client_id: ClientId,
) -> InMemoryTransportEndpoint
pub fn endpoint_for_registered( &self, client_id: ClientId, ) -> InMemoryTransportEndpoint
Returns an endpoint handle for a client that should already be registered.
Sourcepub fn unregister_client(
&self,
client_id: ClientId,
) -> Result<Option<InMemoryClientUnregister>, InMemoryTransportError>
pub fn unregister_client( &self, client_id: ClientId, ) -> Result<Option<InMemoryClientUnregister>, InMemoryTransportError>
Unregisters a client and releases its queued packet storage.
Sourcepub fn queued_len(
&self,
client_id: ClientId,
) -> Result<Option<usize>, InMemoryTransportError>
pub fn queued_len( &self, client_id: ClientId, ) -> Result<Option<usize>, InMemoryTransportError>
Returns queued packet count for a client.
Sourcepub fn queued_capacity(
&self,
client_id: ClientId,
) -> Result<Option<usize>, InMemoryTransportError>
pub fn queued_capacity( &self, client_id: ClientId, ) -> Result<Option<usize>, InMemoryTransportError>
Returns packet slots retained by one client queue.
Sourcepub fn retained_queue_capacity(&self) -> Result<usize, InMemoryTransportError>
pub fn retained_queue_capacity(&self) -> Result<usize, InMemoryTransportError>
Returns packet slots retained across all registered client queues.
Sourcepub fn limits(&self) -> Result<ClientTransportLimits, InMemoryTransportError>
pub fn limits(&self) -> Result<ClientTransportLimits, InMemoryTransportError>
Returns configured limits.
Sourcepub fn stats(&self) -> Result<InMemoryTransportStats, InMemoryTransportError>
pub fn stats(&self) -> Result<InMemoryTransportStats, InMemoryTransportError>
Returns transport statistics.
Trait Implementations§
Source§impl Clone for InMemoryTransportHub
impl Clone for InMemoryTransportHub
Source§fn clone(&self) -> InMemoryTransportHub
fn clone(&self) -> InMemoryTransportHub
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InMemoryTransportHub
impl Debug for InMemoryTransportHub
Auto Trait Implementations§
impl Freeze for InMemoryTransportHub
impl RefUnwindSafe for InMemoryTransportHub
impl Send for InMemoryTransportHub
impl Sync for InMemoryTransportHub
impl Unpin for InMemoryTransportHub
impl UnsafeUnpin for InMemoryTransportHub
impl UnwindSafe for InMemoryTransportHub
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more