pub trait Application:
Send
+ Sync
+ 'static {
// Provided methods
fn on_create<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn on_logon<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn on_logout<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn to_admin<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 mut Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn to_app<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 mut Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), DoNotSend>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn from_admin<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), ApplicationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn from_app<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), ApplicationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Implemented by users of the engine. All callbacks run on the session’s task: a slow callback delays that session (only), exactly like the single-threaded session model of the reference engines.
Because callbacks run on the session task, do not await a
crate::SessionHandle operation for the same session inside a
callback — forward work to another task instead (see the executor
example).
Provided Methods§
Sourcefn on_create<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_create<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
A session was created at engine start.
Sourcefn on_logon<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_logon<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The session completed a logon exchange.
Sourcefn on_logout<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_logout<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The session went offline (logout or disconnect).
Sourcefn to_admin<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 mut Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn to_admin<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 mut Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
An admin message is about to be sent; last chance to mutate it (e.g. add credentials to a Logon).
Sourcefn to_app<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 mut Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), DoNotSend>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn to_app<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 mut Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), DoNotSend>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
An application message is about to be sent (also called for resends,
with PossDupFlag=Y). Return Err(DoNotSend) to suppress it — a resend
is then gap-filled.
Sourcefn from_admin<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), ApplicationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn from_admin<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), ApplicationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
An admin message was received and verified.
Sourcefn from_app<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), ApplicationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn from_app<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_msg: &'life1 Message,
_session_id: &'life2 SessionId,
) -> Pin<Box<dyn Future<Output = Result<(), ApplicationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
An application message was received and verified. This is the main inbound entry point for business messages.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".