Struct netxserver::prelude::Actor
source · [−]pub struct Actor<I> { /* private fields */ }Implementations
sourceimpl<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
) -> impl Future<Output = R> where
T: Future<Output = R>,
pub async fn inner_call<T, R>(
&self,
call: impl FnOnce(Arc<InnerStore<I>>) -> T
) -> impl Future<Output = R> where
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
sourceimpl IAsyncToken for Actor<AsyncToken>
impl IAsyncToken for Actor<AsyncToken>
sourcefn get_session_id(&self) -> i64
fn get_session_id(&self) -> i64
get netx session id
sourcefn new_serial(&self) -> i64
fn new_serial(&self) -> i64
new serial id
sourcefn get_peer<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<Weak<NetPeer>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_peer<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<Weak<NetPeer>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
get tcp socket peer
sourcefn send<'life0, 'async_trait, B>(
&'life0 self,
buff: B
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>> where
B: 'async_trait + Deref<Target = [u8]> + Send + Sync + 'static,
'life0: 'async_trait,
Self: 'async_trait,
fn send<'life0, 'async_trait, B>(
&'life0 self,
buff: B
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>> where
B: 'async_trait + Deref<Target = [u8]> + Send + Sync + 'static,
'life0: 'async_trait,
Self: 'async_trait,
send buff
sourcefn get_token<'life0, 'async_trait>(
&'life0 self,
session_id: i64
) -> Pin<Box<dyn Future<Output = Result<Option<NetxToken>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_token<'life0, 'async_trait>(
&'life0 self,
session_id: i64
) -> Pin<Box<dyn Future<Output = Result<Option<NetxToken>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
get netx token by session id
sourcefn get_all_tokens<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<NetxToken>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_all_tokens<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<NetxToken>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
get all netx token
sourcefn call<'life0, 'async_trait>(
&'life0 self,
serial: i64,
buff: Data
) -> Pin<Box<dyn Future<Output = Result<RetResult>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn call<'life0, 'async_trait>(
&'life0 self,
serial: i64,
buff: Data
) -> Pin<Box<dyn Future<Output = Result<RetResult>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
call
sourceimpl<T: ICreateController + 'static> IAsyncTokenManager for Actor<AsyncTokenManager<T>>
impl<T: ICreateController + 'static> IAsyncTokenManager for Actor<AsyncTokenManager<T>>
fn create_token<'life0, 'async_trait>(
&'life0 self,
manager: Weak<dyn IAsyncTokenManager>
) -> Pin<Box<dyn Future<Output = Result<NetxToken>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_token<'life0, 'async_trait>(
&'life0 self,
session_id: i64
) -> Pin<Box<dyn Future<Output = Result<Option<NetxToken>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_all_tokens<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<NetxToken>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn check_tokens_request_timeout<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn check_tokens_disconnect_timeout<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn peer_disconnect<'life0, 'async_trait>(
&'life0 self,
session_id: i64
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
sourceimpl<T> IPeer for Actor<TCPPeer<T>> where
T: 'static + AsyncRead + AsyncWrite + Send,
impl<T> IPeer for Actor<TCPPeer<T>> where
T: 'static + AsyncRead + AsyncWrite + Send,
fn addr(&self) -> SocketAddr
fn is_disconnect<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Actor<TCPPeer<T>>: 'async_trait,
fn send<'life0, 'async_trait, B>(
&'life0 self,
buff: B
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
B: 'async_trait + 'static + Deref<Target = [u8]> + Send + Sync,
Actor<TCPPeer<T>>: 'async_trait,
fn send_all<'life0, 'async_trait, B>(
&'life0 self,
buff: B
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
B: 'async_trait + 'static + Deref<Target = [u8]> + Send + Sync,
Actor<TCPPeer<T>>: 'async_trait,
fn send_ref<'life0, 'life1, 'async_trait>(
&'life0 self,
buff: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Actor<TCPPeer<T>>: 'async_trait,
fn send_all_ref<'life0, 'life1, 'async_trait>(
&'life0 self,
buff: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Actor<TCPPeer<T>>: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Actor<TCPPeer<T>>: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Actor<TCPPeer<T>>: 'async_trait,
sourceimpl<I, R, T, B, C, IST> ITCPServer<T> for Actor<TCPServer<I, R, T, B, C, IST>> where
I: 'static + Fn(ReadHalf<C>, Arc<Actor<TCPPeer<C>>>, T) -> R + Send + Sync,
R: 'static + Future<Output = Result<(), Error>> + Send,
T: 'static + Clone + Send + Sync,
B: 'static + Future<Output = Result<C, Error>> + Send,
C: 'static + AsyncRead + AsyncWrite + Send,
IST: 'static + Fn(TcpStream) -> B + Send + Sync,
impl<I, R, T, B, C, IST> ITCPServer<T> for Actor<TCPServer<I, R, T, B, C, IST>> where
I: 'static + Fn(ReadHalf<C>, Arc<Actor<TCPPeer<C>>>, T) -> R + Send + Sync,
R: 'static + Future<Output = Result<(), Error>> + Send,
T: 'static + Clone + Send + Sync,
B: 'static + Future<Output = Result<C, Error>> + Send,
C: 'static + AsyncRead + AsyncWrite + Send,
IST: 'static + Fn(TcpStream) -> B + Send + Sync,
fn start<'life0, 'async_trait>(
&'life0 self,
token: T
) -> Pin<Box<dyn Future<Output = Result<JoinHandle<Result<(), Error>>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Actor<TCPServer<I, R, T, B, C, IST>>: 'async_trait,
fn start_block<'life0, 'async_trait>(
&'life0 self,
token: T
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Actor<TCPServer<I, R, T, B, C, IST>>: 'async_trait,
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more