Struct aldrin_broker::PendingConnection
source · pub struct PendingConnection<T: AsyncTransport + Unpin> { /* private fields */ }
Expand description
A pending client connection, that hasn’t been accepted or rejected yet.
This type is acquired by BrokerHandle::begin_connect
. It allows inspection of the client’s
custom data and to accept or reject a
client.
Dropping this type will simply also drop the transport. No message will be sent back to the client in this case.
Implementations§
source§impl<T: AsyncTransport + Unpin> PendingConnection<T>
impl<T: AsyncTransport + Unpin> PendingConnection<T>
sourcepub fn client_data(&self) -> &SerializedValueSlice
pub fn client_data(&self) -> &SerializedValueSlice
Returns the client’s data.
sourcepub fn deserialize_client_data<D: Deserialize>(
&self
) -> Result<D, DeserializeError>
pub fn deserialize_client_data<D: Deserialize>( &self ) -> Result<D, DeserializeError>
Deserializes the client’s data.
sourcepub async fn accept(
self,
broker_data: SerializedValue
) -> Result<Connection<T>, EstablishError<T::Error>>
pub async fn accept( self, broker_data: SerializedValue ) -> Result<Connection<T>, EstablishError<T::Error>>
Accepts a client and sends custom data back to it.
The resulting Connection
must be run
and polled to completion, much
like the Broker
itself.
sourcepub async fn accept_serialize<D: Serialize + ?Sized>(
self,
broker_data: &D
) -> Result<Connection<T>, EstablishError<T::Error>>
pub async fn accept_serialize<D: Serialize + ?Sized>( self, broker_data: &D ) -> Result<Connection<T>, EstablishError<T::Error>>
Accepts a client and sends custom data back to it.
The resulting Connection
must be run
and polled to completion, much
like the Broker
itself.
sourcepub async fn reject(
self,
broker_data: SerializedValue
) -> Result<(), EstablishError<T::Error>>
pub async fn reject( self, broker_data: SerializedValue ) -> Result<(), EstablishError<T::Error>>
Rejects a client and sends custom data back to it.
sourcepub async fn reject_serialize<D: Serialize + ?Sized>(
self,
broker_data: &D
) -> Result<(), EstablishError<T::Error>>
pub async fn reject_serialize<D: Serialize + ?Sized>( self, broker_data: &D ) -> Result<(), EstablishError<T::Error>>
Rejects a client and sends custom data back to it.