Trait INetXClient

Source
pub trait INetXClient {
Show 15 methods // Required methods fn init<C: IController + Sync + Send + 'static>( &self, controller: C, ) -> impl Future<Output = ()>; fn connect_network( self: &Arc<Self>, ) -> impl Future<Output = Result<()>> + Send; fn get_tls_config(&self) -> TlsConfig; fn get_address(&self) -> String; fn get_service_info(&self) -> ServerOption; fn get_session_id(&self) -> i64; fn get_mode(&self) -> u8; fn new_serial(&self) -> i64; fn is_connect(&self) -> bool; fn get_peer(&self) -> impl Future<Output = Option<Arc<NetPeer>>>; fn set_network_client( &self, client: Arc<NetPeer>, ) -> impl Future<Output = ()>; fn get_callback_len(&self) -> impl Future<Output = usize>; fn close(&self) -> impl Future<Output = Result<()>>; fn call( &self, serial: i64, buff: Data, ) -> impl Future<Output = Result<RetResult>>; fn run(&self, buff: Data) -> impl Future<Output = Result<()>>;
}

Required Methods§

Source

fn init<C: IController + Sync + Send + 'static>( &self, controller: C, ) -> impl Future<Output = ()>

Initializes the NetX client controller.

§Parameters
  • controller: The controller to initialize, which must implement the IController trait and be Sync, Send, and 'static.
§Returns

A future that resolves to a Result<()>.

Source

fn connect_network(self: &Arc<Self>) -> impl Future<Output = Result<()>> + Send

Connects to the network.

§Returns

A future that resolves to a Result<()>.

Source

fn get_tls_config(&self) -> TlsConfig

Gets the TLS configuration.

§Returns

The TLS configuration.

Source

fn get_address(&self) -> String

Gets the NetX server address.

§Returns

The server address as a String.

Source

fn get_service_info(&self) -> ServerOption

Gets the NetX client service configuration.

§Returns

The service configuration as a ServerOption.

Source

fn get_session_id(&self) -> i64

Gets the NetX session ID.

§Returns

The session ID as an i64.

Source

fn get_mode(&self) -> u8

Gets the NetX mode.

§Returns

The mode as a u8.

Source

fn new_serial(&self) -> i64

Generates a new serial ID.

§Returns

The new serial ID as an i64.

Source

fn is_connect(&self) -> bool

Checks if the client is connected to the server.

§Returns

true if connected, false otherwise.

Source

fn get_peer(&self) -> impl Future<Output = Option<Arc<NetPeer>>>

Gets the TCP socket peer.

§Returns

A future that resolves to an Option<Arc<NetPeer>>.

Source

fn set_network_client(&self, client: Arc<NetPeer>) -> impl Future<Output = ()>

Sets the TCP socket peer.

§Parameters
  • client: The network client to set.
§Returns

A future that resolves to ().

Source

fn get_callback_len(&self) -> impl Future<Output = usize>

Gets the length of the request wait callback.

§Returns

A future that resolves to the length as a usize.

Source

fn close(&self) -> impl Future<Output = Result<()>>

Closes the NetX client.

§Returns

A future that resolves to a Result<()>.

Source

fn call( &self, serial: i64, buff: Data, ) -> impl Future<Output = Result<RetResult>>

Calls a function with the given serial and buffer.

§Parameters
  • serial: The serial ID.
  • buff: The data buffer.
§Returns

A future that resolves to a Result<RetResult>.

Source

fn run(&self, buff: Data) -> impl Future<Output = Result<()>>

Runs the client with the given buffer.

§Parameters
  • buff: The data buffer.
§Returns

A future that resolves to a Result<()>.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: SessionSave + 'static> INetXClient for Actor<NetXClient<T>>

Implementation of the INetXClient trait for Actor<NetXClient<T>>.

This implementation provides the external operations for the NetXClient, including methods for initializing the controller, connecting to the network, getting configuration and session information, generating serial IDs, and checking connection status.