pub struct RaknetClient { /* private fields */ }Expand description
Single-session high-level RakNet client.
Implementations§
Source§impl RaknetClient
impl RaknetClient
Sourcepub async fn connect(server_addr: SocketAddr) -> ClientResult<Self>
pub async fn connect(server_addr: SocketAddr) -> ClientResult<Self>
Connects with default RaknetClientConfig.
Sourcepub async fn connect_with_retry(
server_addr: SocketAddr,
config: RaknetClientConfig,
policy: ReconnectPolicy,
) -> ClientResult<Self>
pub async fn connect_with_retry( server_addr: SocketAddr, config: RaknetClientConfig, policy: ReconnectPolicy, ) -> ClientResult<Self>
Connects with retry policy.
Sourcepub async fn connect_with_config(
server_addr: SocketAddr,
config: RaknetClientConfig,
) -> ClientResult<Self>
pub async fn connect_with_config( server_addr: SocketAddr, config: RaknetClientConfig, ) -> ClientResult<Self>
Connects using explicit client configuration.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Returns local socket address used by this client.
Sourcepub fn server_addr(&self) -> SocketAddr
pub fn server_addr(&self) -> SocketAddr
Returns remote server address.
Sourcepub fn metrics_snapshot(&self) -> SessionMetricsSnapshot
pub fn metrics_snapshot(&self) -> SessionMetricsSnapshot
Returns session-level metrics snapshot.
Sourcepub async fn send(&mut self, payload: impl Into<Bytes>) -> ClientResult<()>
pub async fn send(&mut self, payload: impl Into<Bytes>) -> ClientResult<()>
Sends payload with default send options.
Sourcepub async fn send_with_options(
&mut self,
payload: impl Into<Bytes>,
options: ClientSendOptions,
) -> ClientResult<()>
pub async fn send_with_options( &mut self, payload: impl Into<Bytes>, options: ClientSendOptions, ) -> ClientResult<()>
Sends payload with explicit options.
Sourcepub async fn send_with_receipt(
&mut self,
payload: impl Into<Bytes>,
receipt_id: u64,
options: ClientSendOptions,
) -> ClientResult<()>
pub async fn send_with_receipt( &mut self, payload: impl Into<Bytes>, receipt_id: u64, options: ClientSendOptions, ) -> ClientResult<()>
Sends payload and tracks a receipt id.
Sourcepub async fn disconnect(&mut self, reason_code: Option<u8>) -> ClientResult<()>
pub async fn disconnect(&mut self, reason_code: Option<u8>) -> ClientResult<()>
Gracefully disconnects client.
Sourcepub async fn next_event(&mut self) -> Option<RaknetClientEvent>
pub async fn next_event(&mut self) -> Option<RaknetClientEvent>
Polls next client event.
Returns None once client is fully closed and pending events are drained.
Auto Trait Implementations§
impl !Freeze for RaknetClient
impl RefUnwindSafe for RaknetClient
impl Send for RaknetClient
impl Sync for RaknetClient
impl Unpin for RaknetClient
impl UnsafeUnpin for RaknetClient
impl UnwindSafe for RaknetClient
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