pub trait Session:
Send
+ Sync
+ Debug {
// Required methods
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 Message,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn recv<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn send_fd<'life0, 'async_trait>(
&'life0 self,
fd: RawFd,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn recv_fd<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RawFd, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn client_handshake<'life0, 'async_trait>(
&'life0 self,
hello: Hello,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
'life0: 'async_trait { ... }
fn server_handshake<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
validator: &'life1 dyn TokenValidator,
router: &'life2 dyn Router,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
A higher-level session that speaks the Message protocol over a FramedConnection.
Required Methods§
Provided Methods§
Sourcefn send_fd<'life0, 'async_trait>(
&'life0 self,
fd: RawFd,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_fd<'life0, 'async_trait>(
&'life0 self,
fd: RawFd,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a file descriptor via SCM_RIGHTS (Unix only).
This is used for transferring memfd-backed shared memory blobs. The FD should be sent after the control message that references it.
Sourcefn recv_fd<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RawFd, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recv_fd<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RawFd, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receive a file descriptor via SCM_RIGHTS (Unix only).
This is used for receiving memfd-backed shared memory blobs. The FD should be received after the control message that references it.
Sourcefn client_handshake<'life0, 'async_trait>(
&'life0 self,
hello: Hello,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
fn client_handshake<'life0, 'async_trait>(
&'life0 self,
hello: Hello,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
Client-side handshake helper.
Sends Hello and waits for HelloOk or HelloErr. Returns bound capability
set on success. Avoids panics; errors map to Error.
Sourcefn server_handshake<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
validator: &'life1 dyn TokenValidator,
router: &'life2 dyn Router,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn server_handshake<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
validator: &'life1 dyn TokenValidator,
router: &'life2 dyn Router,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySet, Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Server-side handshake helper.
Waits for Hello, validates the token, replies with HelloOk/HelloErr, and registers the connection on success.