pub trait IAsyncToken {
type Controller: IController;
// Required methods
fn get_session_id(&self) -> i64;
fn new_serial(&self) -> i64;
fn get_peer(&self) -> impl Future<Output = Option<Arc<NetPeer>>>;
fn send(&self, buff: Vec<u8>) -> impl Future<Output = Result<()>>;
fn get_token(
&self,
session_id: i64,
) -> impl Future<Output = Result<Option<NetxToken<Self::Controller>>>>;
fn get_all_tokens(
&self,
) -> impl Future<Output = Result<Vec<NetxToken<Self::Controller>>>>;
fn call(
&self,
serial: i64,
buff: Data,
) -> impl Future<Output = Result<RetResult>>;
fn run(&self, buff: Data) -> impl Future<Output = Result<()>>;
fn is_disconnect(&self) -> impl Future<Output = bool>;
}Expand description
Trait defining the interface for an asynchronous token.
Required Associated Types§
Sourcetype Controller: IController
type Controller: IController
The type of the controller.
Required Methods§
Sourcefn get_session_id(&self) -> i64
fn get_session_id(&self) -> i64
Sourcefn new_serial(&self) -> i64
fn new_serial(&self) -> i64
Sourcefn get_peer(&self) -> impl Future<Output = Option<Arc<NetPeer>>>
fn get_peer(&self) -> impl Future<Output = Option<Arc<NetPeer>>>
Gets the TCP socket peer.
§Returns
impl std::future::Future<Output = Option<Arc<NetPeer>>>- A future that resolves to an optionalArcreference to the network peer.
Sourcefn get_token(
&self,
session_id: i64,
) -> impl Future<Output = Result<Option<NetxToken<Self::Controller>>>>
fn get_token( &self, session_id: i64, ) -> impl Future<Output = Result<Option<NetxToken<Self::Controller>>>>
Sourcefn get_all_tokens(
&self,
) -> impl Future<Output = Result<Vec<NetxToken<Self::Controller>>>>
fn get_all_tokens( &self, ) -> impl Future<Output = Result<Vec<NetxToken<Self::Controller>>>>
Gets all network tokens.
§Returns
impl std::future::Future<Output = Result<Vec<NetxToken<Self::Controller>>>>- A future that resolves to a vector ofNetxToken.
Sourcefn is_disconnect(&self) -> impl Future<Output = bool>
fn is_disconnect(&self) -> impl Future<Output = bool>
Checks if the connection is disconnected.
§Returns
impl std::future::Future<Output = bool>- A future that resolves to a boolean indicating if the connection is disconnected.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".