pub struct Actor<I> { /* private fields */ }
Expand description
Actor Model Ensure Thread safety and high performance writing
Implementations§
Source§impl<I> Actor<I>where
I: 'static,
impl<I> Actor<I>where
I: 'static,
pub fn new(x: I) -> Actor<I>
Sourcepub async fn inner_call<T, R>(
&self,
call: impl FnOnce(Arc<InnerStore<I>>) -> T,
) -> Rwhere
T: Future<Output = R>,
pub async fn inner_call<T, R>(
&self,
call: impl FnOnce(Arc<InnerStore<I>>) -> T,
) -> Rwhere
T: Future<Output = R>,
Behavior through queues,thread safe call async fn
Sourcepub unsafe fn deref_inner(&self) -> RefInner<'_, I>
pub unsafe fn deref_inner(&self) -> RefInner<'_, I>
§Safety
This is a thread unsafe way to get When using, please make sure there is no thread safety problem
Trait Implementations§
Source§impl<T: SessionSave + 'static> INetXClient for Actor<NetXClient<T>>
Implementation of the INetXClient
trait for Actor<NetXClient<T>>
.
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.
Source§async fn init<C: IController + Sync + Send + 'static>(&self, controller: C)
async fn init<C: IController + Sync + Send + 'static>(&self, controller: C)
Initializes the NetX client controller. Read more
Source§fn get_tls_config(&self) -> TlsConfig
fn get_tls_config(&self) -> TlsConfig
Gets the TLS configuration. Read more
Source§fn get_address(&self) -> String
fn get_address(&self) -> String
Gets the NetX server address. Read more
Source§fn get_service_info(&self) -> ServerOption
fn get_service_info(&self) -> ServerOption
Gets the NetX client service configuration. Read more
Source§fn get_session_id(&self) -> i64
fn get_session_id(&self) -> i64
Gets the NetX session ID. Read more
Source§fn new_serial(&self) -> i64
fn new_serial(&self) -> i64
Generates a new serial ID. Read more
Source§fn is_connect(&self) -> bool
fn is_connect(&self) -> bool
Checks if the client is connected to the server. Read more
Source§async fn get_callback_len(&self) -> usize
async fn get_callback_len(&self) -> usize
Gets the length of the request wait callback. Read more
Source§impl<T> SocketClientTrait for Actor<TcpClient<T>>
impl<T> SocketClientTrait for Actor<TcpClient<T>>
async fn send<B>(&self, buff: B) -> Result<usize, Error>
async fn send_all<B>(&self, buff: B) -> Result<(), Error>
async fn send_ref(&self, buff: &[u8]) -> Result<usize, Error>
async fn send_all_ref(&self, buff: &[u8]) -> Result<(), Error>
async fn flush(&self) -> Result<(), Error>
async fn disconnect(&self) -> Result<(), Error>
Auto Trait Implementations§
impl<I> !Freeze for Actor<I>
impl<I> !RefUnwindSafe for Actor<I>
impl<I> Send for Actor<I>
impl<I> Sync for Actor<I>
impl<I> Unpin for Actor<I>
impl<I> !UnwindSafe for Actor<I>
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